Hi and thanks for reading.
SELECT DISTINCT (thisID and thisNAME) from table1 WHERE thisID IN
(SELECT id from table2 WHERE ... condtions)
OR
(SELECT id from table3 WHERE ... different condtions)
OR
(SELECT id from table99 WHERE ...even more conditions)
I need to perform a few SELECTS to provide a nu,ber of thisID's once I have these I need to select only thethisID and thisNAME from the table 1.
I must admit Im a little out of my depth with writing queries...but Im certain Im on the right lines? Any help please??
Your SQL is pretty close. You need to repeat the IN
part and fix a few outher syntactic stuff:
SELECT DISTINCT thisID, thisNAME
from table1
WHERE thisID IN (SELECT id from table2 WHERE ... conditions) OR
thisID IN (SELECT id from table3 WHERE ... different conditions) OR
thisID IN (SELECT id from table99 WHERE ...even more conditions);