有一条sql
select * from table
where id in (select id from table1)
or id in (select id from table2)就是id 要在两个表里选,我怎么样要让table1的id 排在 table2的前面希望高手回答,谢谢了 !!!
select * from table
where id in (select id from table1)
or id in (select id from table2)就是id 要在两个表里选,我怎么样要让table1的id 排在 table2的前面希望高手回答,谢谢了 !!!
where id in (select id from table1)
union
select * from table
where id in (select id from table2)
(select *, NewOrder=1 from tb where id in (select id from table1)
union all
select *, NewOrder=2 from tb where id in (select id from table2) and id not in (select id from table1)) T
order by NewOrder