小的分组问题,路过的进来帮下。谢谢
名称      单价      总价               面积 
 ------------------ 
 A               120               1200               56 
 B               100               1000               30 
 C                  80                  5000               120 
 D               100                  5000            200 
 希望出来结果:   
 名称      单价段      总价段         面积 
 -------------------------------- 
 A               100-120      1000-1200      50-65 
 B               80-100         80-1000            30以下 
 C               80以下         5000以上         100-120       
 D               80-100         5000以上         200以上   
------解决方案--------------------select 名称, 
 case when 单价 <=80 then  '80以下 ' 
     when 单价> 80 and 单价 <=100 then  '80-100 ' 
     when 单价> 100 and 单价 <=120 then  '100-120 ' 
     when 单价> 120 and 单价 <=140 then  '120-140 ' 
     when 单价> 140 and 单价 <=160 then  '140-160 ' 
     when 单价> 160 then  '160以上 ' 
     end as 单价段, 
    ...                --其他类似 
 from 表
------解决方案--------------------多种加一起就有问题了? 
 那可以用存储过程来生成 
 动态