+ -
当前位置:首页 → 问答吧 → order by case ...end 语法是什么

order by case ...end 语法是什么

时间:2007-03-09

来源:互联网

谁知道order   by   case   ...end   的语法?

作者: xf_ling   发布时间: 2007-03-09

不懂

作者: pdw2009   发布时间: 2007-03-14

是按条件来排序,举个简单的例子:select   a,b,c   from   tab   order   by   case   表达式   when   条件1   then   a   when   条件2   then   b   else   c   end;    
这个select语句就是当表达式满足条件1的时候就按a来排序,满足条件2的时候就按b排序,否则就按c排序

作者: sunqin119   发布时间: 2007-03-14

decode

作者: zheninchangjiang   发布时间: 2007-03-14

不太懂啊。我这里的是 when indexId >4 then '0' else '1' end 

作者: guopengNo1   发布时间: 2011-11-25