UPDATE t1
SET t1.language_id = (SELECT distinct(CASE WHEN NETWORK.nid = 11
THEN 10
ELSE 7
END)
FROM PROFILE,
NETWORK
WHERE PROFILE.STATUS IN ('A','U','S','H','I')
AND PROFILE.mid = t1.mid
AND NETWORK.mid = t1.mid
AND t1.is_deleted = 'N')
AND EXISTS( SELECT 1
FROM PROFILE,
NETWORK
WHERE PROFILE.STATUS IN ('A','U','S','H','I')
AND PROFILE.mid = t1.mid
AND NETWORK.mid = t1.mid
AND t1.is_deleted = 'N');
这是慢下来的方式。对使用语句使用不同的更新?为 10 进行一次更新,为 7 进行一次更新。