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 -> Re: Can someone simplify this query

Re: Can someone simplify this query

From: kirtan <kirtan.acharya_at_gmail.com>
Date: 9 Feb 2005 21:13:17 -0800
Message-ID: <1108012397.275337.10980@z14g2000cwz.googlegroups.com>


Sagaran wrote:
> Use this query, this should work.
>
> select a.officecode off1, a.acno_code acc1,
> sum(current_purchase_amount) over (partition by a.office_code,
> a.acno_code) as sum1,
> b.officecode off2, b.account_code acc2,
> sum(org_budget_amt) over (partition by b.account_code,
> b.office_code) as sum3,
> sum(rev_budget_amt) over (partition by b.account_code,
> b.office_code) as sum4
> from bweb_assetpurchasetxndetails a, bweb_budgetmaster b
> where a.officecode (+) = b.officecode
> and a.acno_code (+) = b.account_code;

Hi,
Thanks for your reply. I tried out your query but it is giving me the same results as I had gotten before. The total of the budget amount (org_budget_amt) was as many times the correct total as there were no. of rows in the assetpurchasetxndetails table. I modified the query I was using and now i'm using the following query.

   It may or may not be the most efficient practice but it's working for me. Any further suggestions are always welcome.

P.S. I've changed the name of the second table

SELECT a.busarea_code off1, a.acno_code acc1, avg(org_budget_amt),sum(amt) from
bweb_glcard a, bweb_budgetmaster b where a.busarea_code=b.officecode and a.acno_code=b.account_code
group by a.busarea_code , a.acno_code Received on Wed Feb 09 2005 - 23:13:17 CST

Original text of this message

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