I'm trying to figure out a way to do a update on the database but I keep failing. I can't really think of something else.
IF @EventID = 9
BEGIN
declare @HwanLevel int;
UPDATE SRO_VT_SHARD.._Char set HwanLevel = 1 WHERE CharID in (SELECT TOP(1) EXP,LEVEL,CONTRIBUTION FROM SRO_VT_SHARD.._CharTrijob WHERE JobType = 1 AND CharID = @CharID)
UPDATE SRO_VT_SHARD.._Char set HwanLevel = 2 WHERE CharID in (SELECT TOP(1) EXP,LEVEL,CONTRIBUTION FROM SRO_VT_SHARD.._CharTrijob WHERE JobType = 2 AND CharID = @CharID)
UPDATE SRO_VT_SHARD.._Char set HwanLevel = 3 WHERE CharID in (SELECT TOP(1) EXP,LEVEL,CONTRIBUTION FROM SRO_VT_SHARD.._CharTrijob WHERE JobType = 3 AND CharID = @CharID)
END
OHH and when I tried to use it I kept getting; "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS." I have tried joins etc and case when but didn't really work out. what I'm trying to do is:
SELECT Top(1) EXP,Contribution,Level
THEN check if Jobtype = 1 then set HwanLevel to 1
if jobtype = 2 then set hwanlevel to 2
etc until 3