select count(*)/2 from person where ispair = 1 and RegDate < '2009-01-01'
select max(t.cnt) from( select count(1) as cnt from Person where UserSex='男' and RegDate < '2009-01-01' union all select count(1) as cnt from Person where UserSex='女' and RegDate < '2009-01-01' ) t
嗯 Good 想请问一下count(1) union all是什么意思
count(1)和count(*)一样就是统计符合条件的记录数 union all就是合并两个结果集
from(
select count(1) as cnt from Person where UserSex='男' and RegDate < '2009-01-01'
union all
select count(1) as cnt from Person where UserSex='女' and RegDate < '2009-01-01'
) t
想请问一下count(1) union all是什么意思
count(1)和count(*)一样就是统计符合条件的记录数 union all就是合并两个结果集