1

I have a table resources (title, resourceid) and another table classifications (title, resourceid, classificationid)

I want to add the tiles from resources to the classification table, there are multiple rows with same resourceid in classifications.

When I wrote this query

update `classification` 
set `title`= (select title 
              from Resources 
              where Resources.`resourceid` = classification.`resourceid`)

I got this error:

Error - subquery returns more than 1 row.

1 Answer 1

1

Try grouping the subquery by title, i.e.:

UPDATE classification SET title=(SELECT title FROM Resources
    WHERE Resources.resourceid=classification.resourceid GROUP BY title);
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.