日期:2014-05-18  浏览次数:20469 次

关于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 all
select count(id) as good from table where id between '1' and '11'