Good afternoon, I hope you are well. I have a problem with a SQL query that paints to be simple but I think it is not, I have the following table with this information:
id pais sexo
== ======== ====
1 Venezuela F
2 Venezuela F
3 Venezuela M
4 Colombia F
5 Colombia F
6 Colombia F
7 Colombia M
8 Brasil F
9 Brasil F
I must make a query, that you return the information to me in this way:
pais femenino masculino
========= ======== =========
Venezuela 2 1
Colombia 3 1
Brasil 2 0
I have thought something like this:
SELECT count(per1.sexo), count(per2.sexo), per1.pais, per2.pais
FROM 'personas' per1,'personas' per2
WHERE
per1.sexo = "F"
AND per2.sexo = "M"
group by(per1.pais)
but it is not the solution and it does not work for me, please if you can help me, thank you very much:)