I need to get ALL id1 where id3 = 100
I've tried
SELECT id1 FROM "table 1" WHERE id2 = (SELECT id2 FROM "table 2" WHERE id3='100');
But it can be more than 1 result for id2.. so ofcourse i got an error
How can I get this data??
CodePudding user response:
If I read correctly, a simple join should work here:
SELECT t1.id1
FROM Table1 t1
INNER JOIN Table2 t2
ON t2.id2 = t1.id2
WHERE t2.id3 = 100;
CodePudding user response:
SELECT id1
FROM "table 1"
WHERE id2 IN ( SELECT id2
FROM "table 2"
WHERE id3='100'
);