怎么我用这段代码
select hm, count(*)
from
(
select hm1 as hm from table1
union all
select hm2 as hm from table1
union all
select hm3 as hm from table1
)
group by hm
改进耙子的程序
原:
select hm, count(*)
from
(
select hm1 as hm from table1
union
select hm2 as hm from table1
union
select hm3 as hm from table1
)
group by hm
改:
select A.hm, count(A.hm) As Itm
from
(
select hm1 as hm from table1
union all
select hm2 as hm from table1
union all
select hm3 as hm from table1
) A
group by A.hm