Oracle Query Help
Date: 19 Jun 2001 18:21:21 -0700
Message-ID: <e8a45386.0106191721.2d2c3e0e_at_posting.google.com>
Hi,
I am trying to create a SQL query to create a report off of a table
that isn't really in
Person.
I want a report that looks something for this.
Date ProductA ProductB ProductC
I tried something like
the form I want. Ideally this would be in the form of a view that I
could select of a
particular personid.
Personid Date Product Quantity
1 1/3/94 A 4
1 1/5/94 A 3
1 1/3/94 B 5
1 1/5/94 C 8
1/3/94 4 5 0
1/5/95 3 0 8
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
but I get something more like this
Date ProductA ProductB ProductC
1/3/94 4 0 0 1/5/95 3 0 0 1/3/94 0 5 0 1/5/95 0 0 8
Not quite right. Received on Wed Jun 20 2001 - 03:21:21 CEST