使用union将多个查询合并到一个记录集
[ 2010-10-30 08:11:29 | 作者: admin ]
将多个查询合并输出,每个查询调用不同的显示页
select top 50 Id,Title,Addtime,url='news1-detail.aspx' from New1
union ( SELECT top 50 Id,Title,Addtime,url='news2-detail.aspx' FROM news2 WHERE isdel=0 order by addtime desc )
union ( SELECT top 50 Id,Title,Addtime,url='news3-detail.aspx' FROM news3 WHERE isdel=0 order by addtime desc )
ORDER BY Addtime DESC
union ( SELECT top 50 Id,Title,Addtime,url='news2-detail.aspx' FROM news2 WHERE isdel=0 order by addtime desc )
union ( SELECT top 50 Id,Title,Addtime,url='news3-detail.aspx' FROM news3 WHERE isdel=0 order by addtime desc )
ORDER BY Addtime DESC
1