parafanaylya
parafanaylya

Reputation: 13

Syntax error #1064

this is my query:

update `zen_meta_tags_products_description` 
set `metatags_keywords`= 'ice machine, ice maker, ice flaker, Brema,'
WHERE `products_id` = ('1231'; '1232'; '1233'; '1234'; '1235'; '1236'; '1237'; '1238'; '1239'; '1240';) 

Error

MySQL said: Documentation

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1232, 1233' at line 1

Upvotes: 1

Views: 98

Answers (2)

John Conde
John Conde

Reputation: 219924

You cannot use = to compare multiple values. You need to use IN(). The separator for values in IN() is a comma, not a semi colon. The last one is also not necessary and will cause an error. The quotes around the IDs are also not necessary unless you actually did store them as strings.

update zen_meta_tags_products_description 
set metatags_keywords= 'ice machine, ice maker, ice flaker, Brema,' 
WHERE products_id IN(1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240)

Upvotes: 3

Saty
Saty

Reputation: 22532

Remove semicolom from your list

Insted of = use IN to get write result:

UPDATE `zen_meta_tags_products_description` 
set `metatags_keywords`= 'ice machine, ice maker, ice flaker, Brema,'
WHERE `products_id` IN ('1231', '1232', '1233','1234', '1235', '1236', '1237', '1238', '1239', '1240') ;

Upvotes: 1

Related Questions