So, I have 2 users, one of which is called admin, the other is admin2.
I wrote an SQL query in which I want to increase the achievement of a specific account, in my case only for admin, but contrary to this, the same achievement for the user is admin2also affected. What am I doing wrong?
DECLARE @Achievement1 INT
SELECT @Achievement1 = Achievement1
FROM [dbo].[Achievement]
WHERE [dbo].[Achievement].UserID = (SELECT [AccountID]
FROM [dbo].[Account]
WHERE [Username] = 'Admin')
IF (@Achievement1 < 100)
UPDATE [dbo].[Achievement]
SET [Achievement1] += 2
ELSE
UPDATE [dbo].[Achievement]
SET [Achievement1] += 0
source
share