日期:2014-05-18 浏览次数:20341 次
--无重复项(a,b,c,d...)的总数目
select count(*)
from(select c1 from table
union
select c2 from table
union
select c3 from table
union
select c4 from table
union
select c5 from table
union
select c6 from table) as T
--每个项(a,b,c,d...)的出现次数
select c1,count(*)
from(select c1 from table
union all
select c2 from table
union all
select c3 from table
union all
select c4 from table
union all
select c5 from table
union all
select c6 from table) as T
group by c1