[HELP] Update SQL only if group = user

Hello ! So i made a Execute Query for reset jobs at ID 1 when player disconnect, like this :

MySQL:executeQuery("UPDATE users SET `job`='1' WHERE identifier = '@identifier'",
		{['@identifier'] = Users[source].identifier})

It work !

But now, i need to update the job, ONLY if it’s a user ( if it’s admin, or other group name, no update )

I try this :

MySQL:executeQuery("UPDATE users SET `job`='1' WHERE identifier = '@group'",
		{['@group'] = Users[source].group})

And errors popup when i disconnect. Someone can help me with that ? I’m pretty bad at SQL…

Thanks !

‘identifier’ is a table column that stores an identifier for the user. (Steam ID, IP, etc.). You need to check the ‘group’ column to see if it equals ‘user’. What you are currently doing is checking the ‘identifier’ column and seeing if it equals the ‘group’ of the source user.

You would need something like (not tested but hopefully you get the idea)

MySQL:executeQuery("UPDATE users SET `job`='1' WHERE `identifier` = '@identifier' 
AND `group` = 'user'", {['@identifier'] = Users[source].identifier})

I’m gonna check and try that, update soon !

It works ! Thanks buddy