可能重复:
oracle PL/SQL:排序行
我运行这个查询:
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
但我的产品栏不按顺序排列。
产品
PROD_1
PROD_10
PROD_2
PROD_3
PROD_4
PROD_5
PROD_6
PROD_7
PROD_8
PROD_9
PROD_10 应该在最后的第二行。我怎样才能解决这个问题?