vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| SELECT * FROM (SELECT officecode t1_office, account_code t1_account, SUM (org_budget_amt) t1_sum_orig FROM bweb_budgetmaster GROUP BY officecode, account_code) tab1, (SELECT nvl(officecode, 'a') t2_office, acno_code t2_account, SUM (current_purchase_amount) t2_sum_amt FROM bweb_assetpurchasetxndetails GROUP BY officecode, acno_code) tab2 WHERE tab1.t1_office = tab2.t2_office(+) AND tab1.t1_account = tab2.t2_account(+) Hi, I want to basically summarize two different tables. I want the sum of the amount grouped by office code and account code. These two fields are the same in both the tables. can i use a single group by clause and join the two tables? The above query works fine for me, but I need to simplify these as I'm working on Crystal reports which accepts only one SELECT clause. Thanks in advance, |