The simplest way would be to append a LIMIT 1
onto the end of the subquery to only force it to return a single row.
I have to update all the rows in a table. Here is my query
-
02-12-2021 - |
Question
UPDATE tracks
SET People_id_Reference = (SELECT People_id
FROM People
RIGHT JOIN top100
ON
People_name=top100.artist )
WHERE People_id_Reference IS NULL;
But I get Error like this:
ERROR 1242(21000): SUBQUERY RETURNS MORE THAN ONE ROW
Can some on help me with this. Thanks in advance
La solution
Autres conseils
change your code like this :
SELECT *
FROM package_reviews
WHERE post_id
= ANY (SELECT post_id
FROM wp_posts
WHERE post_author
=1);
this link is very useful
http://dev.mysql.com/doc/refman/5.0/en/subquery-errors.html
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow