this way...
select val,count(*) as Occurance from
(
select a as Val from tblnm _
union all |
select b from tblnm |
union all > this will get col a,b,c,d & then using union all merge all cols
select c from tblnm |
union all |
select d from tblnm _|
) as t
group by val
Happy Coding!
:)