日期:2014-05-17  浏览次数:20587 次

这条语句要怎么改。。。
select top 3 * from test where type='xz'order by NEWID()
union 
select top 3 * from test where type='pd'order by NEWID()

我想合并这两个结果集  

现在是  
消息 156,级别 15,状态 1,第 3 行关键字 'union' 附近有语法错误。

要怎么改 。

------解决方案--------------------
select * from a
union
select * from b
order by NEWID()


order by要放在最后,你可以把两条语句的结果插入到零时表,然后用union 
------解决方案--------------------
select * from(select top 3 * from test where type='xz'order by newid())t
union
select * from(select top 3 * from test where type='pd'order by newid())t