Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: [Q] Sum on differents fields
select sum(quantite), sum(decode(b.mm,'0',A.quantite,0)),
sum(decode(b.pp,'0',A.quantite,0)), sum(decode(b.mp,'0',A.quantite,0))
from A,B
where
A.id = B.id
On Mon, 9 Aug 1999 11:50:22 +0400, "Emmanuel Lecoester" <elecoest_at_francemel.com> 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)
>
>Thanks a lot
>
>
>
>
>
Received on Mon Aug 09 1999 - 06:25:18 CDT
![]() |
![]() |