Mysql
 sql >> Database >  >> RDS >> Mysql

Copiare i dati MySQL e creare un nuovo record con una condizione

eri abbastanza vicino cambia semplicemente new in combined .

INSERT INTO combined (ip, user_ID)
SELECT  old.ip, new.user_ID
FROM    old
        INNER JOIN new 
            on old.email = new.email;

AGGIORNAMENTO 1

INSERT INTO combined (ip, user_ID, status)
SELECT  old.ip, new.user_ID, 'approved'
FROM    old
        INNER JOIN new 
            on old.email = new.email;