现在我有这个命令:
UPDATE Users
SET Coins = Coins + @num,
Сoins_Bought = Сoins_Bought + @num
WHERE Discord_Id = @id;
UPDATE Users
SET Coins = Coins + @numForReferrer
WHERE Discord_Id =
(SELECT Referrer from Users WHERE Discord_Id = @id);
很难用语言解释我需要什么,所以我将大致展示:
UPDATE Users
SET Coins = Coins + @num,
Сoins_Bought = Сoins_Bought + @num
WHERE Discord_Id = @id;
(SELECT Referrer from Users WHERE Discord_Id = @id) AS Referrer_Id
IF Referrer_Id != NULL
UPDATE Users
SET Coins = Coins + @numForReferrer
WHERE Discord_Id = Referrer_Id;
我希望意思很清楚。编写这样一个命令的正确方法是什么?
如果我理解正确: