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

关于COUNT 查询的

2012-03-08 
关于COUNT 查询的求助select * from(select count(id) as good from table where id between 1 and 10

关于COUNT 查询的求助
select * from 
(select count(id) as good from table where id between '1' and '10' ) a, 
(select count(id) as good from table where id between '1' and '11') b 
结果是 一条记录里,两个字段
good good
 10 11 
请问要怎样把结果变成 两条记录,同一字段呢
good
10
11  


[解决办法]
select count(id) as good from table where id between '1' and '10'
union all
select count(id) as good from table where id between '1' and '11'
[解决办法]

SQL code
select count(id) as good from table where id between '1' and '10'union allselect count(id) as good from table where id between '1' and '11' 

热点排行