我想試圖做的是更新我的子表時,我的父母狀態爲「已刪除」更新父母表狀態
父母表
-------------
PID | CID |Pstatus
1 | 1 | Deleted
2 | 1 | Active
3 | 2 | Deleted
4 | 2 | Deleted
背後的邏輯是類似下面
IF CID = 1 and PsTatus = deleted
Update ChildTableStatus
Set Status = 'Deleted'
Where CID = 1
Else
cannot update childtablestatus to deleted due to there are active records
如何在這裏執行循環檢查?
請向我們展示ChildTableStatus的模式並解釋表之間的關係。 – HABO