Mysql
 sql >> Base de données >  >> RDS >> Mysql

Compter les occurrences sur plusieurs colonnes

S'il n'y a que 6 colonnes, alors une façon de procéder

select Number, count(*) From (select Number1 as Number from your_table
union all
select Number2 as Number from your_table
union all
select Number3 as Number from your_table
union all
select Number4  as Number from your_table
union all
select Number5  as Number from your_table
union all
select Number6 as Number from your_table) myTab
group by Number;