I am trying to run the query bellow, and I get a mismatched datatype error for the two "sum" computation columns. I thought that using "null" in the corresponding columns would eliminate the problem, but it does not. If I print the "sum" columns from both select statements in the same column it works, but I need them to be side by side...any ideas?
select o.market,
sum(
round(t.gross_c omm * e.ex_for_per_mi n * nvl(s.revsplit, 100)/100,
2))
+
sum(
round((t.tp - t.mkup) * e.ex_for_per_mi n * nvl(s.revsplit, 100)/100,
2)) "HK",null
from split s, exchange e, tinfoco t, client p, client c, orders o
where o.clientid = c.clientid
AND P.createloc like 'HK'
and p.clientid = nvl(c.profile_p arent_id,c.clie ntid)
and o.orderid = t.orderid
and o.tradedate = e.ex_date
and o.currid = e.currid
and exists (select null from client_profile prof
where prof.clientid = p.clientid)
and o.clientid = s.clientid(+)
and o.tradedate between to_date('14-JUN-2005','DD-MON-YYYY')
and to_date('14-JUN-2005','DD-MON-YYYY')
and nvl(o.errorflag ,'*') not in ('E','S')
group by o.market
union
select o.market,null,
sum(
round(t.gross_c omm * e.ex_for_per_mi n * nvl(s.revsplit, 100)/100,
2))
+
sum(
round((t.tp - t.mkup) * e.ex_for_per_mi n * nvl(s.revsplit, 100)/100,
2)) "NY"
from split s, exchange e, tinfoco t, client p, client c, orders o
where o.clientid = c.clientid
AND P.createloc like 'NY'
and p.clientid = nvl(c.profile_p arent_id,c.clie ntid)
and o.orderid = t.orderid
and o.tradedate = e.ex_date
and o.currid = e.currid
and exists (select null from client_profile prof
where prof.clientid = p.clientid)
and o.clientid = s.clientid(+)
and o.tradedate between to_date('14-JUN-2005','DD-MON-YYYY')
and to_date('14-JUN-2005','DD-MON-YYYY')
and nvl(o.errorflag ,'*') not in ('E','S')
group by o.market
0 1030 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Stephen Miller |
last post by:
Firstly, sorry for the long post, but I've included a fair bit of
sample data.
Im doing a comparision of 10yr Bond prices and CPI adjustments, with
an 18 week moving average of the CPI. I'm using a nested sub-query to
calculate the moving average, but I'm having difficulty selecting
exactly 18 data points (ie When I include the 'HAVING COUNT(C1.Closes)
= 18' line, I get no results).
Can anyone help?
|
by: Bill |
last post by:
I've created this:
SELECT
c.ProjectID,
Count(c.ID) as 'Registrants',
Count(dt.Hits) as 'Submissions'
FROM
CME_TBL c
JOIN
(SELECT ProjectID, Count(*) as Hits FROM CME_TBL
|
by: Leo |
last post by:
Can the value of the union datatype contain leading/trailing white
space if it's not allowed by the member datatypes? For example, in the
following example:
t1.xsd:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.t1.org"
xmlns="http://www.t1.org"
elementFormDefault="qualified">
|
by: DarthMacgyver |
last post by:
Hello,
I recently wrote a survey application. Each question is very similar.
The first questions gives me a problem when there are multiple people
taking the survey (The Database connection Timed out) I am using the
Data Access Application Blocks as ASP.NET (using VB.NET) and SQL 2000.
In there first question there can be up to 27 answers. So I figured
instead of making 27 different trips to the database I woulc just
concatenate my...
|
by: Frank van Vugt |
last post by:
Hi all,
Boiling down a problem in one of my queries, I noticed this behaviour.
# select version();
version
------------------------------------------------------------------------
PostgreSQL 7.4.2 on i586-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
(1 row)
| |
by: Paulo Matos |
last post by:
Hi all,
I'm doing some numerical computations with integers, rationals (from
boost), floating point numbers, etc. I'm defining ints as long int,
rationals (boost class), and floating point are doubles. I'm creating
an interface to these types called just 'number', so that I don't need
to worry with conversions, exactness, etc.
Initial approach was something like:
class number {
|
by: BillCo |
last post by:
I've encountered a problem while using ADO to save query objects.
Union queries created normally (via the interface) appear in adox
catelog.procedures rather than catelog.views. This is reasonably well
documented and I can live with it.
The below seems to be the only way to add queries to a database using
ADO:
Set cmd = New ADODB.Command
cmd.CommandType = adCmdText
|
by: Peter Olcott |
last post by:
Is there anyway of doing this besides making my own string from scratch?
union AnyType {
std::string String;
double Number;
};
|
by: PengYu.UT |
last post by:
Hi,
I'm reading an R-tree implementation converted from C to C++. A union
is used for the internal nodes and the leaves of the tree.
union
{
Node* m_child; ///Child node, if it
is an internal node
DATATYPE m_data; ///Data, if it is a leaf.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |