redneonrt Posted April 27, 2006 Share Posted April 27, 2006 I have two MySql tables and I would like a query that selects everything from table 1 but only if the table1.id from table 1 does not exist in table2.id.Any suggestions? Quote Link to comment Share on other sites More sharing options...
craygo Posted April 27, 2006 Share Posted April 27, 2006 use left join[code]$sql = "SELECT fieldname FROM table1 LEFT JOIN table2 ON table1_id = table2_id WHERE table2_id IS NULL";[/code]Ray Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.