我已經試過這段代碼,它的工作原理,但只對每個客戶的第一個實例。即列應貫穿並將所有訂單添加到以前的欠款中。SQLite。在第一個例子中停止滿足WHERE條件
UPDATE customers_tbl
SET customer_amountowing = customer_amountowing +
(SELECT sorder_amount FROM standingorder_tbl
WHERE standingorder_tbl.sorder_customer = customers_tbl.customer_address1)
WHERE EXISTS
(SELECT * FROM standingorder_tbl
WHERE standingorder_tbl.sorder_customer = customers_tbl.customer_address1);
有誰能告訴我因爲我在這裏錯了。乾杯傢伙!
,如果你運行一個選擇具有相同返回什麼數據'WHERE EXISTS'條款? – Dai
另外,請解釋你的模式。爲什麼'customer_address1'看起來是主鍵而不是'customerId'列? – Dai