How to crosscheck two tables and insert relevant data into a new table in MYSQL?

Posted by JackDamery on Stack Overflow See other posts from Stack Overflow or by JackDamery
Published on 2012-11-22T16:57:49Z Indexed on 2012/11/22 16:59 UTC
Read the original article Hit count: 123

Filed under:
|

I'm trying to crosscheck a row that exists in two tables using a MYSQL query in phpmyadmin and then if a userID is found in both tables, insert their userID and user name into another table. Here's my code:

INSERT INTO userswithoutmeetings SELECT user.userID IF('user.userID'='meeting.userID');

I keep getting plagued by this error:

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 'IF('user.userID'='meeting.userID')' at line 3

Other statements I've tried have worked but not deposited the values in the table.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about statement