So I have a query to implement as:
Show the province that has more patients identified as 'M' than 'F'. Must only show full province_name
provinces table has province_id, province_name, while patients has gender, province_id and other attributes.
My approach is to first determine frequency of each gender for provinces:
SELECT * FROM
(
SELECT province_name, gender, count(gender) as freq from provinces
INNER JOIN patients
ON provinces.province_id = patients.province_id
GROUP BY province_name, gender
)
as province_gender_freq
Now I plan to make a self join on province_gender_freq with join conditions as needed.
Is it optimum way of achieving it?