Jump to content

Insert login name from a table into another table, But don't if it exists.


gergy008

Recommended Posts

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?

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`)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.