Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Sql Query Help -- Aggregating Rows
I'm having trouble figure out how to do this and thought that if I
just asked people could show me some best practices and hopefully
point me to some additional reading material. I've done a bit of sql
but oracle is new to me (we are using oracle 9.? in case it matters)
Anyways, after joining some tables and ignoring columns I don't care
about I have a table that looks like:
PurchaseDate PurchaserID PurchasersCatagory
What they want to do is look at purchases in a three week span this year and last year and get a count by purchasers category for 2006 (excluding those who also bought in 2007), 2007 (excluding...), both years
For example:
PurchaseDate PurchaserID PurchaseCatagory
2006 1 x 2007 1 x 2006 2 x 2006 3 y 2007 4 y 2007 5 z
Then they want
PurchaseCatagory 2006 2007 Both
x 1 0 1 y 1 1 0 z 0 1 0
Thanks,
Bill
Received on Wed Oct 24 2007 - 10:13:54 CDT
![]() |
![]() |