我有 7 个 SQL 查询来完成这样的任务:
1. UPDATE Customer SET CustomerService = 'perta' WHERE FirstName = 'john';
2. UPDATE Customer SET Flag = 1 WHERE OrderNum BETWEEN 2 AND 29;
3. UPDATE Customer SET PurchaseNum = PurchaseNum + 60 WHERE OrderNum BETWEEN 2 AND 29;
4. UPDATE Customer SET OrderNum = OrderNum + 60 WHERE OrderNum BETWEEN 2 AND 29;
5. UPDATE Customer SET PurchaseNum = PurchaseNum - 28 WHERE (PurchaseNum > 29 AND PurchaseNum <= 89) AND (Flag <> 1);
6. UPDATE Customer SET OrderNum = OrderNum - 28 WHERE (OrderNum > 29 AND OrderNum <= 89) AND (Flag <> 1);
7. UPDATE Customer SET Flag = 0 WHERE OrderNum BETWEEN 62 AND 89;
是否可以将这些 SQL 查询“压缩”为 1 个查询?
因为我担心用户通过按 ESC 按钮(在他/她按 SUBMIT 按钮后)取消该过程,这些序列会在中间被破坏,我的桌子也会很乱。