MySQL update with two subqueries

Posted by Julian Cvetkov on Stack Overflow See other posts from Stack Overflow or by Julian Cvetkov
Published on 2010-06-14T23:26:22Z Indexed on 2010/06/14 23:32 UTC
Read the original article Hit count: 213

Filed under:
|

I'm trying to update one column of MySQL table with subquery that returns a date, and another subquery for the WHERE clause.

Here is it:

UPDATE wtk_recur_subs_temp 
   SET wtk_recur_date = (SELECT final_bb.date
                           FROM final_bb, wtk_recur_subs 
                          WHERE final_bb.msisdn = wtk_recur_subs.wtk_recur_msisdn) 
WHERE wtk_recur_subs_temp.wtk_recur_msisdn IN (select final_bb.msisdn 
                                                 from final_bb)

The response from the MySQL engine is "Subquery returns more than 1 row".

© Stack Overflow or respective owner

Related posts about mysql

Related posts about subquery