id time a
1 3
2 2
3 3
4 1
5 2
6
7 2
我现在是按照时间排列 我想再加个条件 按照a排列 把a=3的放前面去 同时不要影响那些a=1.2位置
结果如下id time a
1 3
3 3
2 2
4 1
5 2
6
7 2
1 3
2 2
3 3
4 1
5 2
6
7 2
我现在是按照时间排列 我想再加个条件 按照a排列 把a=3的放前面去 同时不要影响那些a=1.2位置
结果如下id time a
1 3
3 3
2 2
4 1
5 2
6
7 2
select * form table where a=3 order by time desc
和
select * form table where a!=3 order by time desc 2条语句的组合 改怎么写?
UNION
select * form table where a!=3 order by time desc
还是不懂楼主究竟要怎么排列,说清楚点嘛???我想是很复杂的SQL语句。
如果是的话,可以用 unionselect * from tb where a=3
union
select * from tb where a!=3 order by a