I have a table like this:
ID | AGE
--------
1 | 27
2 | 24
1 | 25
4 | 25
1 | 25
5 | 25
5 | 25
...|...
As you can see, ID and AGE are not unique (there is a second ID that is unique, but that's irrelevant here).
I want to return all the distinct IDs with more than one specific value: for example, counting all the IDs with more than one AGE = 25; in the table above, this should yield [1, 5], (ID = 4 is not counted because 25 occurs only once; ID = 1 and ID = 5 IS included because 25 occurs more than once in AGE).
Basically what I want in invalid SQL:
SELECT DISTINCT id FROM table WHERE count(AGE = 25) > 1
Unfortunately, count(AGE = 25) is invalid. How would I write this out in SQL?
SQL