brown2005 Posted August 25, 2006 Share Posted August 25, 2006 $sql = "select * from table1 where members_id not in (select selected_id from table2 where 1)";is this correct as i cant get it to work Link to comment https://forums.phpfreaks.com/topic/18636-help-please/ Share on other sites More sharing options...
hitman6003 Posted August 25, 2006 Share Posted August 25, 2006 [quote]select selected_id from table2 where 1[/quote]That isn't a valid sql query. Aside from your subselect being jacked, it should work.[code]SELECT * FROM table1 WHERE members_id NOT IN (SELECT selected_id FROM table2);[/code] Link to comment https://forums.phpfreaks.com/topic/18636-help-please/#findComment-80298 Share on other sites More sharing options...
brown2005 Posted August 25, 2006 Author Share Posted August 25, 2006 SQL-query : SELECT * FROM websitesWHERE websites_id NOT IN (SELECT websites_hits_idFROM websites_hits)LIMIT 0 , 30 MySQL said: #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT websites_hits_idFROM websites_hits ) LIMIT 0, 30' at li Link to comment https://forums.phpfreaks.com/topic/18636-help-please/#findComment-80299 Share on other sites More sharing options...
Jenk Posted August 25, 2006 Share Posted August 25, 2006 sub selects were only added in mysql 5, check which version of mysql you have.Also, [code]SELECT * FROM `table` WHERE 1[/code] is a valid query, try it. Link to comment https://forums.phpfreaks.com/topic/18636-help-please/#findComment-80333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.