0
我正在嘗試更新活動字段並根據有多少產品已發送給客戶進行設置。但它沒有按預期工作。我有一些recordShipped比totalIssues大但isActive沒有被設置爲false。MySQL與計數的比較
UPDATE xatm.subscriptions a,
(SELECT idSubscription, COUNT(idProduct) issueShipped
FROM xatm.subscriptionshipments
group by idSubscription) b
SET a.isActive = (a.totalIssues > b.issueShipped)
WHERE a.idsubscriptions = b.idSubscription
AND a.isComp = 0 AND a.isReoccurring = 0;
我的感覺是,你的查詢是否正確。你能否包含一些數據來說明你遇到的問題? –