Skip to content
Advertisement

Error 1064 when using SQL with INSERT INTO … SELECT … ON DUPLICATE KEY UPDATE

I am trying to use ‘INSERT INTO … SELECT ON DUPLICATE KEY UPDATE feature’ but I’m in trouble now.

I want to insert data to ‘fruitProperty’ table.

My query is as below:

I met an error code.

error code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘KEY UPDATE cpValue = 1’ at line 21

What’s wrong with my query? I really don’t know..

Thank you.

Advertisement

Answer

Do you get a problem if you use an explicit join:

I suspect the problem is a parsing problem, because MySQL/MariaDB supports the ON clause for CROSS JOIN (yuck!!!). But the ON keyword gets confused.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement