1

我有一张桌子resources (title, resourceid)和另一张桌子classifications (title, resourceid, classificationid)

我想将资源中的图块添加到分类表中,resourceidclassifications.

当我写这个查询

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

我收到了这个错误:

错误 - 子查询返回超过 1 行。

4

1 回答 1

1

尝试按标题对子查询进行分组,即:

UPDATE classification SET title=(SELECT title FROM Resources
    WHERE Resources.resourceid=classification.resourceid GROUP BY title);
于 2011-01-07T06:19:36.257 回答