mysql update 子查询作为条件

UPDATE t_commission_template tct
JOIN (
SELECT
max(id) maxid
FROM
t_commission_template
WHERE
taken_mode = 1
AND t_commission_id = 6
GROUP BY
contract
) temp ON temp.maxid = tct.id
SET tct.open_position_bymoney = 0,
tct.open_position_bylot = 0,
tct.close_position_bymoney = 0,
tct.close_position_bylot = 0,
tct.close_position_today_bymoney = 0,
tct.close_position_today_bylot = 0

posted @ 2020-06-03 18:33  吟恋错  阅读(1380)  评论(1编辑  收藏  举报