If I have two tables with following columns:
Table1: [id,value]
Table2: [id,comment]
where id and value are numeric and comment is a string.
I need to retrieve all the ids with value>50 in the Table1.
And make an
INSERT IGNORE INTO table2 VALUES (id,"higher than 50");
for each one of those ids. How can I make it in MySQL? Thanks
INSERT IGNORE INTO table2
SELECT id,"higher than 50"
FROM Table1 where value > 50;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.