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? Link to comment https://forums.phpfreaks.com/topic/8567-query-help-please/ 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 Link to comment https://forums.phpfreaks.com/topic/8567-query-help-please/#findComment-31402 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.