问一个Union的sql语句问题。
假设我又2长表:
item表:id,name,create_time
gooditem表:id,name,begin_time
现在我需要把这个结果集
select id,name form gooditem order by create_time desc
和
select id,name from item order by begin_time desc
用Union all链接起来。
但是必须是gooditem表和item表分别排序,最后在Union起来,应该如何写?
------解决方案--------------------select * from
(select id,name from item order by id desc) as temp1
union all
select * from
(select id,name from gooditem order by id desc ) as temp2