Mysql
 SQL >> Database >  >> RDS >> Mysql

Come copiare dati da una tabella a un'altra nuova tabella in MySQL?

Questo farà quello che vuoi:

INSERT INTO table2 (st_id,uid,changed,status,assign_status) SELECT st_id,from_uid,now(),'Pending','Assigned' FROM table1 

Se vuoi includere tutte le righe di table1. Altrimenti puoi aggiungere una clausola WHERE alla fine se vuoi inserire solo un sottoinsieme di table1.

Spero che questo sia d'aiuto.