Jan 21, 2004 #1 Tracy3e Technical User Jun 23, 2001 54 CA Hello, just want to do a query to pick out a record from one table if the same userid doesn't exist in the other table. select userid from table1 where userid not in table2; Is that possible? server version: 3.23.54 Thanks.
Hello, just want to do a query to pick out a record from one table if the same userid doesn't exist in the other table. select userid from table1 where userid not in table2; Is that possible? server version: 3.23.54 Thanks.
Jan 21, 2004 #2 sleipnir214 Programmer May 6, 2002 15,350 US Use a left join: select * from table1 t1 left join table2 t2 on t2.userid is null Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!! Upvote 0 Downvote
Use a left join: select * from table1 t1 left join table2 t2 on t2.userid is null Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!!
Jan 21, 2004 #3 sleipnir214 Programmer May 6, 2002 15,350 US (shoulda hit "preview", not "submit" CORRECTION: select * from table1 t1 left join table2 t2 on t1.userid = t2.userid where t2.userid is null that's better. Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!! Upvote 0 Downvote
(shoulda hit "preview", not "submit" CORRECTION: select * from table1 t1 left join table2 t2 on t1.userid = t2.userid where t2.userid is null that's better. Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!!
Jan 21, 2004 Thread starter #4 Tracy3e Technical User Jun 23, 2001 54 CA With a tiny tweak, the command worked! You guys are so helpful - and fast! Thank you. Upvote 0 Downvote