我有一个包含以下字段的表:
ID , FirstName , LastName , Count , Amount
需要这样的代码:
IF EXISTS (SELECT * FROM [myDB] WHERE @ID = [ID])
set [count] = [count] + 1 and [Amount] = [Amount] - 1
我有一个包含以下字段的表:
ID , FirstName , LastName , Count , Amount
需要这样的代码:
IF EXISTS (SELECT * FROM [myDB] WHERE @ID = [ID])
set [count] = [count] + 1 and [Amount] = [Amount] - 1
使用这样的简单更新查询:
UPDATE myDB
SET [count] = [count] + 1
, [Amount] = [Amount] - 1
WHERE ID = @ID
更新 MST_SPR_donategifts 设置 Gift_Quantity = Gift_Quantity-@Gift_Quantity WHERE Gift_Code=@Gift_Code