我想在表if
中插入记录,变量不等于另一个表中的同一列。类似的东西:
Insert IGNORE INTO newtable
SELECT * FROM oldtable
WHERE url="www.theurl.com/1" AND
(field CoolThing from newtable != CoolThing from oldtable)
所以CoolThing
是一个字段(列)。
答案 0 :(得分:0)
尝试:
Insert IGNORE INTO newdata
SELECT o.* /* this is allowed only if the count and order of the
columns of the two tables are exactly the same */
FROM olddata o left join
newdata n on n.coolthing=o.coolthing
WHERE o.url="www.theurl.com/1" AND o.coolthing is NULL