Re: Oracle Query Help

From: Hans Wiezorke <c.und.h_at_t-online.de>
Date: 20 Jun 2001 00:40:09 -0700
Message-ID: <861fd37d.0106192340.4ec92af4_at_posting.google.com>


deaduser_at_hotmail.com (Jeffrey Ellin) wrote in message news:<e8a45386.0106191721.2d2c3e0e_at_posting.google.com>...

> select personid,
> decode(product,A,quantity,0) as producta,
> decode(product,b,quantity,0) as productb,
> decode(product,c,quantity,0) as productc
> from person

try the following:

select
 personid,

 sum(decode(product,A,quantity,0)) as producta,
 sum(decode(product,b,quantity,0)) as productb,
 sum(decode(product,c,quantity,0)) as productc
from person
group by personid

Have fun,
Hans Received on Wed Jun 20 2001 - 09:40:09 CEST

Original text of this message