I need help with a SQL subquery here since this forum seems to be more helpful that some of the others I am on and saw a couple post here about SQL alone so here goes.
I have a table (as a result of a query) showing this information:
+--------------+-----------+-----+
| station_name | viewer_id | sex |
+--------------+-----------+-----+
| techtv | 2 | f |
| techtv | 4 | f |
| techtv | 5 | m |
| techtv | 2 | f |
| techtv | 2 | f |
| NatCore | 8 | f |
| NatCore | 7 | f |
| notebook | 6 | f |
| notebook | 4 | f |
+--------------+-----------+-----+
Which lists which viewers(and the sex of them) who were watching stations.
I need to be able to find the amount of males (and then females,cause it would be the same method) for each stations.
The problem is as in the case of techtv above, the viewer_id can appear more than once and I must count only unique ids within each station. Any idea what kind of subquery would get the results I want?
From the above, techtv is suppose to have 2 females
NatCore = 2 females
Notebook = 2 females