May 20, 2008 at 6:32 am
hello i have a little problem i hope that SQLjunkie can help i try for days to fix or get it to work but no luck:w00t:
i have 4 table ARCASH,ARYCSH,ARMAST and ARYMST
ARCASH is a current tran.
ARYCSH is history Tran.
ARMAST is current Tran.
ARYMST is History Tran.
what i want to do is
UNION ARYCSH AND ARCASH
UNION ARYMST AND ARMAST
and make a relation link between the 2 union table on field "CUSTNO"
now the problem is when i do this
this is what i get
the custno show up and the union data from the arcash/arycsh show up and the union data from arymst/armast the first record keep repeat it self this is what i mean
CUSTNO----------PAIDAMT(ARCASH/ARYMST)------------INVAMT(ARMAST/ARYMST)
ALL001 ----------11000------------------------------------- 12500
CUS101 ----------900---------------------------------------- 12500
CAR124 ----------700---------------------------------------- 12500
GOE451 ----------4500--------------------------------------- 12500
TOL003 -----------1587 ---------------------------------------12500
ALL001 ------------25487------------------------------------- 12500
ALL002------------- 5787-------------------------------------- 12500
ALL001 -------------5465 --------------------------------------12500
as you can see armast/arymst first record over and over
how do i fix this or get it to work
thanks
kevin.
May 20, 2008 at 6:48 am
[font="Verdana"]I guess, you might have missed some join. Post table structure and sample data.[/font]
MH-09-AM-8694
May 20, 2008 at 7:04 am
Your union will return records from both tables unless you perform an aggregation on each table in the query for each query of the union.
The other option which can be used is to place the records into a temp table and then apply the aggregations to the raw records.
From your details we can not see your full selection criteria - but maybe a group by on the custno is required and then sum(AMT) columns
let us know
Thanks
Kevin
May 20, 2008 at 9:00 am
thanks i will let you know i made a few views testing it now
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy