在表A中有三个字段 A1,A2,A3,有n行数据,请用sql语句查出,在表A中 ,已经出现的数字共出现的次数
表A 数据如下
A1 A2 A3
2 2 4
3 12 6
1 3 8
13 43 21
24 21 53
1 11 22
------解决方案--------------------
select T.An,count(T.An) from
(select A1 as An from A
union all
select A2 as An from A
union all
select A3 as An from A ) T group by T.An