By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,400 Members | 981 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,400 IT Pros & Developers. It's quick & easy.

merging complex Select statements

didajosh
P: 47
Currently I am getting the report which gives me following information:

ID NAME STATUS HOLD-TYPE EXP-DATE ACT-DATE

from four various tables, using decode, nested select MAX and order by function.

Now I have to add 3 more columns:

Amt-Due Amt-Bal Total-Due

ID is the primary key.

Since Students pay in installments.

Amt-Due: Comes from a seperate table "X" and it is the sum ID wise,i.e.
select sum(Amt-Due) from X group by ID

similarly

Amt-Bal: Comes from a seperate table "Y" and it is the sum ID wise,i.e.
select sum(Amt-Bal) from Y group by ID

And Total-Due is Amt-Due-Amt-Bal

I have to merge all this in one table, so my resulting table should be...


ID NAME STATUS HOLD-TYPE EXP-DATE ACT-DATE Amt-Due

Amt-Bal Total-Due

how can I do this?
Please help :(

dipali
Aug 22 '08 #1
Share this Question
Share on Google+
2 Replies


didajosh
P: 47
i think i need to explain more....
Amt-Due: Comes from a seperate table "X" and it is the TOTAL Amt-Due, ID wise,i.e.
select sum(Amt-Due) from X group by ID

similarly

Amt-Bal: Comes from a seperate table "Y" and it is the TOTAL Amt-Bal, ID wise,i.e.
select sum(Amt-Bal) from Y group by ID

And Total-Due is difference of Amt-Due & Amt-Bal

Dipali
Aug 22 '08 #2

didajosh
P: 47
it ok...i found a solution.....

..
dipali
Sep 2 '08 #3

Post your reply

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