Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Case statement in Group by ?
Here is a complete explaination of what I am trying:
I have a table which lets say looks like this:
ID - Type - Amount - Color - Store
1 - S - 10 - RED - CMS 2 - L - 20 - Blue - CMS 3 - X - 20 - Pink - CMS 4 - S - 30 - RED - LT1 5 - L - 40 - Blue - LT1 6 - X - 40 - Pink - LT1 7 - Q - 25 - Grey - LSW
Now lets say, I want to see the result like this:
Amount - Store
Now lets say, I want to pass an variable for color, which would change that SQL so that I get this result:
Color - Amount
Blue - 2 Pink - 2 Grey - 1
I want to be able to get both results depending on the variable I pass. If I pass a color, then I would like to see the below result. If not then the above one. Received on Thu Feb 10 2005 - 11:31:32 CST