SQL查询需要更多时间来执行并最终得到错误

问题描述 投票:0回答:1
UPDATE member
SET member.usableSum = (SELECT usablesum
        FROM fundrecord
        WHERE (member.id= fundrecord.memberId) AND id IN (
        SELECT MAX(id)
        FROM [enter image description here][1]fundrecord
        GROUP BY memberId)
        )
mysql sql execution
1个回答
0
投票
请在查询中使用DISTINCT,>>

UPDATE member SET member.usableSum = (SELECT distinct usablesum FROM fundrecord WHERE (member.id= fundrecord.memberId) AND id IN ( SELECT MAX(id) FROM [enter image description here][1]fundrecord GROUP BY memberId) )

© www.soinside.com 2019 - 2024. All rights reserved.