RE: Most efficient query

2002-05-09 Thread Max Anderson
SELECT main.id FROM MainTable main OUTER JOIN MapTable map ON main.id = map.id WHERE map.id = null Does this work? Give it a whirl. Another solution could be to do it like this: SELECT col1, col2, coln FROM MainTable WHERE id IN ( SELECT id FROM MainTable WHERE id NOT IN ( S

Re: Most efficient query

2002-05-09 Thread Augey Mikus
Correction. I can see a mistake in my syntax. the correct statement to pull the list of name in MainTable that ARE in mapMainTable is: select MainTable.Name from MainTable inner join MapTable using (ID); this works. but how can I pull the list of names that ARE NOT in the map table? Augey

Re: Most efficient query

2002-05-09 Thread Harrison C. Fisk
You can do this with a pretty simple left join as follows: SELECT MainTable.ID from MainTable LEFT JOIN MapTable ON MainTable.ID=MapTable.ID where MapTable.ID IS NULL; Because it is a left join, it will pad all MainTable entries that don't appear in MapTable with NULL's. Hence we can check if t