读书人

求求:合并sql查询语句,该如何解决

发布时间: 2012-03-27 13:44:24 作者: rapoo

求求:合并sql查询语句
select top 5 * from news where newstype=1
select top 5 * from news where newstype=2
select top 5 * from news where newstype=3
select top 5 * from news where newstype=4

这四条语句,怎么用一条sql语句来写!




[解决办法]
select top 5 * from news where newstype=1union all select top 5 * from news where newstype=2union all select top 5 * from news where newstype=3...........

读书人网 >ASP

热点推荐