Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Can someone simplify this query

Can someone simplify this query

From: kirtan <kirtan.acharya_at_gmail.com>
Date: 8 Feb 2005 21:12:28 -0800
Message-ID: <1107925948.712094.98010@g14g2000cwa.googlegroups.com>


Hi,

SELECT *
  FROM (SELECT officecode off1, acno_code acc1,

                 SUM (current_purchase_amount) sum1
            FROM bweb_assetpurchasetxndetails
        GROUP BY officecode, acno_code) tab1,
       (SELECT   officecode off2, account_code acc2, SUM
(org_budget_amt) sum3,
                 SUM (rev_budget_amt) sum4
            FROM bweb_budgetmaster
        GROUP BY account_code, officecode) tab2
 WHERE tab1.off1 (+)= tab2.off2
   AND tab1.acc1 (+)= tab2.acc2

can someone help me simplify this query. preferably with a single select clause? the reason i'm using this kind of query is that if i use a single group by clause, it causes the sum of the budget amount and the rev budget amount to be calculated incorrectly. it is displayed as many times as there are rows in the asset purchase table for a given combination of office code and account code.

I'm using Crystal Reports 10, and I want to use this query. can someone help me?

thanks in advance,
kirtan Received on Tue Feb 08 2005 - 23:12:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US