informer30
MIS
Hi All,
I have 2 select statements, where I have placed a union....The part I do not understand is the top 4 rows returned are bringing back a references that do not exist in either of the individual select statements.
For e.g. when I run ref = 2 in the individual sql statements I cannot get the row back it does not exist, however when I union these rows are appearing...
Any Ideas?
Select DUMMY.Ref, sum (AMOUNT) as AMOUNT
FROM
(select (SUBSTR (transfer_ref, 4, 10)) Ref,
(AMOUNT*-1)as AMOUNT
from Employee.Reference
union
select to_char((request_id)) as Ref,
AMOUNT as AMOUNT
from Old_Employee.Reference
)DUMMY
group by Ref
having sum (AMOUNT) <> 0
Many Thanks
I have 2 select statements, where I have placed a union....The part I do not understand is the top 4 rows returned are bringing back a references that do not exist in either of the individual select statements.
For e.g. when I run ref = 2 in the individual sql statements I cannot get the row back it does not exist, however when I union these rows are appearing...
Any Ideas?
Select DUMMY.Ref, sum (AMOUNT) as AMOUNT
FROM
(select (SUBSTR (transfer_ref, 4, 10)) Ref,
(AMOUNT*-1)as AMOUNT
from Employee.Reference
union
select to_char((request_id)) as Ref,
AMOUNT as AMOUNT
from Old_Employee.Reference
)DUMMY
group by Ref
having sum (AMOUNT) <> 0
Many Thanks