比如有个表有张表字段为id和state
id state
1--->3
2--->4
3--->3
4--->1
我怎么把state值为3的显示在最前面
排序后结果为:
1--->3
3--->3
2--->4
4--->1
id state
1--->3
2--->4
3--->3
4--->1
我怎么把state值为3的显示在最前面
排序后结果为:
1--->3
3--->3
2--->4
4--->1
调试欢乐多
这个要求很普遍,比如一个具有置顶功能的bbs
select id,state,if(state=3,1,0) as settop from tablename order by settop desc,id asc;