Re: Query Question

From: <exec_at_chicagorsvp.com>
Date: Sun, 14 Sep 2008 11:45:00 -0700 (PDT)
Message-ID: <e8be011f-71a6-4571-a197-53f9701e4682@f36g2000hsa.googlegroups.com>


On Sep 14, 1:13 pm, hpuxrac <johnbhur..._at_sbcglobal.net> wrote:
> On Sep 14, 1:30 pm, e..._at_chicagorsvp.com wrote:
>
> > Hi,
>
> > I have a column with the following values:  A or D
>
> > What I want is to have those values in the same linme like this:
>
> > A (some data), D (some data)
>
> > How can I get each value as a different column??
>
> > Thanks!
>
> Not quite sure by what you mean by "A (some data), D (some data)" can
> you give a more detailed example.  Include several rows that have A or
> D values in that column as base data and give us exactly what you want
> to see.
>
> You can always select the same column twice in the same SELECT ( and
> then say use 2 different DECODE's on it for example ) ... is that what
> you are asking?

Well, say for example the data in my table looks like this:

C1 C2
- ----------

A         56
A         11
D         76
D         33

select decode(c1,'A','A'), sum(c2), decode (c1,'D','D'), sum(c2) from y group by c1;

D SUM(C2) D SUM(C2)
- ---------- - ----------

A         67           67
         109 D        109

See, you actually get 2 records when I want 1 record with the values across:

A 67 D 109

Does that make more sense? Received on Sun Sep 14 2008 - 13:45:00 CDT

Original text of this message