| 发表于:2007-11-19 13:11:077楼 得分:10 |
select branch,month_plan,month_result, float(month_result)/float(month_plan) as mon_rate, row_number() over (order by float(month_result)/float(month_plan) desc) as mon_order, year_plan,year_result,float(year_result)/float(year_plan) as year_rate, row_number() over (order by float(year_result)/float(year_plan) desc) as year_order from product as a order by a.branch@ 结果: branch month_plan month_result mon_rate mon_p year_plan year_result year_rate year_p ----------- ----------- ------------ ------------------------ -------------------- ----------- ----------- ------------------------ -------------------- 10 100 80 +8.00000000000000e-001 3 1000 600 +6.00000000000000e-001 2 20 200 60 +3.00000000000000e-001 4 3500 1200 +3.42857142857143e-001 4 30 90 100 +1.11111111111111e+000 1 2000 1000 +5.00000000000000e-001 3 40 130 120 +9.23076923076923e-001 2 3000 2000 +6.66666666666667e-001 1 | | |
|