gergy008 Posted December 7, 2009 Share Posted December 7, 2009 Get where I'm coming from? It's bugging me, I thought this would work but no!! INSERT INTO `gaming` ('login') SELECT `login` FROM `users` WHERE (NOT EXISTS (SELECT `login` FROM `gaming`)) Link to comment https://forums.phpfreaks.com/topic/184317-insert-login-name-from-a-table-into-another-table-but-dont-if-it-exists/ Share on other sites More sharing options...
taquitosensei Posted December 7, 2009 Share Posted December 7, 2009 I think you're looking for not in INSERT INTO `gaming` ('login') SELECT `login` FROM `users` WHERE `login` not in (SELECT `login` FROM `gaming`) Link to comment https://forums.phpfreaks.com/topic/184317-insert-login-name-from-a-table-into-another-table-but-dont-if-it-exists/#findComment-973082 Share on other sites More sharing options...
gergy008 Posted December 7, 2009 Author Share Posted December 7, 2009 I think you're looking for not in INSERT INTO `gaming` ('login') SELECT `login` FROM `users` WHERE `login` not in (SELECT `login` FROM `gaming`) Sorry it is saying syntax error, I think it might be where the ('login') is, But I have no idea. Anyone have any ideas why it says syntax error? Link to comment https://forums.phpfreaks.com/topic/184317-insert-login-name-from-a-table-into-another-table-but-dont-if-it-exists/#findComment-973086 Share on other sites More sharing options...
premiso Posted December 7, 2009 Share Posted December 7, 2009 Because login is a column and if they are denoted they need to be denoted by back ticks ( ` ) and not single quotes ( ' ). Fixing that should get it to work (I tested a similar version on my server). INSERT INTO `gaming` (`login`) SELECT `login` FROM `users` WHERE `login` not in (SELECT `login` FROM `gaming`) Link to comment https://forums.phpfreaks.com/topic/184317-insert-login-name-from-a-table-into-another-table-but-dont-if-it-exists/#findComment-973092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.