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

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top