-1
You can simply group and sort to see which one repeats the most
select tipo_doenca, count(tipo_doenca)
from tb_grafico
where localidade = 'Centro'
group by tipo_doenca
order by count(tipo_doenca) desc
EDIT as noted by @sorack, if you want to see all localities, you can add the locality in the select
and in the group by
. Also need to remove from where
and it would be interesting to include in order by
for easy viewing:
select localidade, tipo_doenca, count(tipo_doenca)
from tb_grafico
group by localidade, tipo_doenca
order by localidade, count(tipo_doenca) desc
What have you tried so far? What exactly is your difficulty?
– Diego Rafael Souza