Possible Duplicate:
oracle PL/SQL: sort rows
I run this query:
Select a.product, sum(
case
when b.id=1 then round(c.sales,3)
else 0
end) as Q1_2008,
sum(
case
when b.id=2 then round(c.sales,3)
else 0
end) as Q2_2008,
sum(
case
when b.id=3 then round(c.sales,3)
else 0
end) as Q3_2008
from products a, quarters b, sales c
where
a.id=c.PRODUCT_ID and
b.id=c.QUARTER_ID
group by a.product
order by product
But my Product column is not in order.
PRODUCT
PROD_1
PROD_10
PROD_2
PROD_3
PROD_4
PROD_5
PROD_6
PROD_7
PROD_8
PROD_9
PROD_10 is the second row when it should be at the end. How can I fix this?
Here is an example of an “order by” statement that does what you want: