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

Home -> Community -> Usenet -> c.d.o.misc -> Re: [Q] Sum on differents fields

Re: [Q] Sum on differents fields

From: Denis <star-dragon_at_usa.net>
Date: Mon, 9 Aug 1999 15:26:57 GMT
Message-ID: <37AEF341.504DC2E7@usa.net>


Emmanuel Lecoester wrote:
>
> I have 2 tables A and B.
> For the moment I have 4 request on them :
> select sum (quantite) from A ;
> select sum (quantite) from A and B where A.id=B.id and B.mn='O' ;
> select sum (quantite) from A and B where A.id=B.id and B.pp='O' ;
> select sum (quantite) from A and B where A.id=B.id and B.mp='O' ;
>
> Can I optimized these four requests in one ? (because each request take 30
> seconds and I execute them 150 times)

select sum (quantite) from A ;
select sum (quantite) from A and B where A.id=B.id and (B.mn='O' or
B.pp='O' or B.mp='O');

                               Maystrenko Denis (star-dragon_at_usa.net)
Received on Mon Aug 09 1999 - 10:26:57 CDT

Original text of this message

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