UPDATE t_user o JOIN (
SELECT owner_address, item_id, SUM(amount) as t FROM t_market_store WHERE `status`=3 AND item_id=10001 GROUP BY owner_address
) t ON o.address = t.owner_address
SET o.gold = o.gold + t.t;
UPDATE t_market_store SET `status`=1 WHERE `status`=3;
