假设表_table有4个字段
select * from _table as t order by if(t.id='1',3,1) desc这样的查询结果和
select * from _table as t order by if(t.id='1',3,10) desc这样的查询结果不一样,
想不明白order by 后面有if后查询和直接写字段名或字段列数不一样
...全文
29回复打赏收藏
mysql ordery by if语句查询
假设表_table有4个字段 select * from _table as torder by if(t.id='1',3,1) desc这样的查询结果和 select * from _table as torder by if(t.id='1',3,10) desc这样的查询结果不一样, 想不明白order by 后面有if后查询和直接写字段名或字段列数不一样