(SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*' order by jt desc) union all (SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' order by jt desc)
order by jt desc 好象没有用啊????
...全文
984打赏收藏
这个联合查询怎么排序?有难度啊?
(SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*' order by jt desc) union all (SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' order by jt desc) order by jt desc 好象没有用啊????
我在其他库上测试,上面那样的语句时可以按设想的排序的,但ACCESS好像不行,只能对总的结果才有用。单单实现你想要的查询的话,可以,添个附加字段:
(SELECT *,'1' as myorder FROM qiye where Bigclass='003' and title like '*灯芯绒*') union all (SELECT *,'2' as myorder FROM qiye where Bigclass='003' and title like '*仿平绒*') order by myorder,jt desc
select * from (SELECT * FROM qiye where Bigclass='003' and title like '*灯芯绒*' union all SELECT * FROM qiye where Bigclass='003' and title like '*仿平绒*' ) as a order by jt desc