473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with Union and datatypes

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_comm * e.ex_for_per_min * nvl(s.revsplit,100)/100,
2))
+
sum(
round((t.tp - t.mkup) * e.ex_for_per_min * 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_parent_id,c.clientid)
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_comm * e.ex_for_per_min * nvl(s.revsplit,100)/100,
2))
+
sum(
round((t.tp - t.mkup) * e.ex_for_per_min * 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_parent_id,c.clientid)
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
Jun 16 '06 #1
0 1019

Sign in to post your reply or Sign up for a free account.

Similar topics

6
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...
6
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
0
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"?>...
3
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...
8
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 ------------------------------------------------------------------------...
5
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...
5
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...
84
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; };
3
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; ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.