1

Got following SQL, category_ids is array type, trying to update its value with subquery data, looks like cc.id doesn't work here. thanks!

update product 
set category_ids = '{cc.id}'
from category cc where cc.location = 'USA';

1 Answer 1

1

Use the array constructor:

... SET category_ids = ARRAY[cc.id]

In your query, cc.id is part of a string literal and is taken, erm, literally.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.