Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top