General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Report SQL question
I have a header table that holds disbursment information.
cust# - disb_seq - disb_amt - dda_amt
123 ----- 01 ------- 50 ------- 30
123 ----- 02 ------- 30 ------- 30
333 ----- 01 ------- 20 ------- 0
I also have a disbursement dda detail table. Any of the disbursment amt that went to a dda account will have a record(s).
cust# - disb_seq - dda_no - dda_amt
123 ----- 01 ------- 433 ---- 10
123 ----- 01 ------- 431 ---- 20
123 ----- 02 ------- 445 ---- 30
Now I want a report that looks like
CUST# DISB_AMT
123 80
DDA # 433 10
DDA # 431 20
DDA # 445 30
CUST# DISB_AMT
333 20
I am trying to get the result set just from SQL. But I need the dda detail information in the result set and it causes the disbursement header records to be repeated which causes my Disb_amt field to be incorrect (the 80 from Cust 123 came from summing two disbursements). If I try to SUM on the amount fields and GROUP BY Custno, I then lose the Disb_seq which I need to join with the disb_dda table (only certain disb_no really qualify for the report).
Any ideas for this report challenged person?
Thanks
Brenda
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only