I have 2 tables. Table A has just one column called ID which has a list of Ids 1 ,2 ….n
Table B has 3 columns: ID (references ID column in table A); key,value
So table B goes like this:
ID KEY VALUE
1 x true
1 y false
1 z true
2 x false
2 y false
2 z false
..
…..
So each ID from table A has got 3 entries in table B
I need a query that fetches all Ids from table A that has got x,y, and z all marked as false in table B. So if any of x, y, z is true for a particular Id, we do not select it.
I tried this but this is wrong:
select A.id from A,B where A.id = B.id and B.key in ('x','y','z') and B.value = 'false'
Can you please help me with the right query?
Nearly there: