Re: Oracle Query Help

From: Jeffrey Ellin <deaduser_at_hotmail.com>
Date: 20 Jun 2001 16:32:57 -0700
Message-ID: <e8a45386.0106201532.223d8e48_at_posting.google.com>


Thanks, just what I needed.

Jeff

crappy <nospam_at_newsranger.com> wrote in message news:<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,
> 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
>
> which yields
>
> PERSONID THEDATE PRODUCTA PRODUCTB PRODUCTC
> ---------- --------- ---------- ---------- ----------
> 1 03-JAN-94 4 5 0
> 1 05-JAN-94 3 0 8
>
>
> 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...
> >
> >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 Thu Jun 21 2001 - 01:32:57 CEST

Original text of this message