Tom
Tom

Reputation: 1263

Update query with multiple subqueries

Here is the update I'm trying to run:

UPDATE  oc_product_gpf SET
brand =  '(select name from oc_manufacturer where manufacturer_id=
(select manufacturer_id from oc_product where product_id = oc_product_gpf.product_id) )'
WHERE  oc_product_gpf.gpf_id =2454;

The error I'm receiving is '#1406 - Data too long for column 'brand' at row 1'

Any suggestions? Thanks in advance!

Upvotes: 0

Views: 67

Answers (1)

user1881277
user1881277

Reputation:

Your subquery not acting as a subquery here. it simply act as a string and trying to assign to "brand" column. Please remove the '' or convert that in to a join

Upvotes: 2

Related Questions