Reputation: 21739
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.
Upvotes: 1
Views: 1097
Reputation: 838086
Another way to do it:
(SELECT member_id FROM races WHERE l_id = '$mem_id'
UNION
SELECT $other_id)
Upvotes: 4
Reputation: 152206
Try with:
UPDATE statistics
SET money = money + $money
WHERE member_id IN (
SELECT member_id
FROM races
WHERE l_id = $mem_id
)
OR member_id = $other_id
And suggestion - for int
type columns do not use apostrophs.
Upvotes: 7