Hello.
I'm doing a query to return the number of events performed by states. I am adding the events by adding the state table through the inner join and grouping by state. The data is returned, I know which state has the most event number, but since I want the state that made the most event, I can not.
Querying without max:
select count(et.sql_et_descricao_evento) as quantidade, e.sql_es_nome_estado as estado
from sql_eventos_turisticos as et
inner join sql_estado as e on (e.sql_es_cod_estado = et.sql_et_cod_estado)
group by e.sql_es_nome_estado;
select count(et.sql_et_descricao_evento) as quantidade, e.sql_es_nome_estado as estado
from sql_eventos_turisticos as et
inner join sql_estado as e on (e.sql_es_cod_estado = et.sql_et_cod_estado)
group by e.sql_es_nome_estado having max(quantidade);
How do I do this?