I have an SQL table like this:
id | f1 | f2
1 | a | hi
2 | a | sup
3 | b | hi
I need a query that grabs the rows where f2 = hi OR f2 = sup, but only if f1 has the same value in both rows. So my query would grab id 1 and id 2, but NOT 3
So basically this –
SELECT * FROM `table` WHERE (`f2` = 'hi' OR `f2` = 'sup') AND 'f1-is-the-same'
1 Answer