摘要:
前一阵子有一个需求,要按照用户的需求安排排序规则:举例:数据库为Oracle,针对表table_example的class字段排序,class字段值为:A、B、C、D。用户要求table_example中的数据按照class字段值C、A、D、B的顺序排序。方法一:开始想了一个方法是select的时候增加一个自定义字段custom,当class的值为C、A、D、B时令custom的值为1、2、3、4.利用case when时,发现无需增加自定义字段即可实现:select * from teble_exaple order by( case class when 'C' th... 阅读全文
posted @ 2013-05-18 19:44
不应挽留
阅读(9609)
评论(0)
推荐(0)
浙公网安备 33010602011771号