1
I need to perform a sub query in Query but the data types of the columns are different. I am using the structure below but it is in error :
SELECT MIN(POPULACAO), nome_mun from cidades
select CAST(populacao AS varchar (50) ) FROM cidades
where nome_mun= ( SELECT MIN(POPULACAO) from cidades)
group by nome_mun,populacao
I need to bring only the municipality with the smallest number of inhabitants of the table. If someone suggests a simpler Query.
If I use only the SELECT MIN(POPULACAO)
, name_mun from cities group by name_mun it brings the whole table . Within the population table has the type Int and name_mun varchar (50). Actually this type of conversion in Sql leaves me a little confused rs.
Now it makes sense. Thank you very much.
– Bruno Henrique