The database is not mine. The structure is
fid| uid | value
3 | 3 | spain
3 | 5 | France
2 | 3 | 45
6 | 3 | male
6 | 5 | female
2 | 5 | 32
The field ID is primary key in another table, I'd like to forget about. Im trying to find all uid that have values 'spain', 'male'
I have the following working.
SELECT uid
FROM DATABASE
WHERE value IN ('spain', 'male') GROUP BY uid HAVING COUNT(*) >= 2
The catch is as follows.. How would I select male, spain with value in range of 20-30 (that is males born in spain aged between 20-30?
Thanks a ton!!