首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

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

2012-03-27 
求求:合并sql查询语句selecttop5*fromnewswherenewstype1selecttop5*fromnewswherenewstype2selecttop5*

求求:合并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...........

热点排行