Re: Oracle Query Help
Date: Wed, 20 Jun 2001 16:20:36 GMT
Message-ID: <o34Y6.2710$yp1.78559_at_www.newsranger.com>
i think there's a little confusion here because in your 'desired' resultset,
personid doesn't appear but the query you propose selects it.
if you do want personid in there try this combination of the first two
suggestions:
select personid,thedate,
which yields
PERSONID THEDATE PRODUCTA PRODUCTB PRODUCTC
if you don't want it there, just leave it out of the select list and the group
by.
In article <e8a45386.0106200545.22c41016_at_posting.google.com>, Jeffrey Ellin
says...
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, thedate
---------- --------- ---------- ---------- ----------
1 03-JAN-94 4 5 0
1 05-JAN-94 3 0 8
>
>c.und.h_at_t-online.de (Hans Wiezorke) wrote in message news:<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
>
>This gives me a total for all weeks. I need it broken up by weeks.
>
>Jeff
Received on Wed Jun 20 2001 - 18:20:36 CEST