WHERE id IN doesn't work in UPDATE

Posted by Donator on Stack Overflow See other posts from Stack Overflow or by Donator
Published on 2010-05-01T16:51:06Z Indexed on 2010/05/01 16:57 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

UPDATE static
SET money = money + '100'
WHERE member_id IN (SELECT member_id FROM race WHERE race_id = '$race_id')"

I want to retrieve member_ids and give for all of them +100 money. What's wrong?

© Stack Overflow or respective owner

WHERE id IN doesn't work in UPDATE

Posted by Donator on Stack Overflow See other posts from Stack Overflow or by Donator
Published on 2010-05-01T17:38:39Z Indexed on 2010/05/01 17:47 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

UPDATE statistics'
SET money = money + '$money'
WHERE member_id IN
((SELECT member_id FROM races WHERE l_id = '$mem_id'), $other_id)

What's wrong with that? I want to retrieve all member_ids from races and also include to member_id $other_id. Without $other_id it works.

By the way, it gives me "Subquery returns more than 1 row" error.

© Stack Overflow or respective owner

Related posts about in

    Related posts about mysql