Given a table T with
|rowid| fld1 | fld2|
|1 | 1 | 10 |
|2 | 1 | 20 |
|3 | 2 | 10 |
|4 | 3 | 20 |
if I want to get all the fld1 values with fld2 = 10 AND fld2 = 20.
This would only be fld1 – the only one with fld2 values 10 and 20.
Is my best way to go a subquery:
select * from T where fld2 = 10 and rowid in (select rowid from T where fld2 = 20);
or is there a better query?
I hope I have understood your question
If you don’t need to retrieve all rows
this query suffices.