Through the following query, I want to update the ConcurrentJobs
column only when the value in MaxConcurrentJobs
column is greater than or equal to
the value of ConcurrentJobs
being updated.
insert into userjobinfo (UserId,ConcurrentJobs) values (335,2300)
on duplicate key update ConcurrentJobs = case when values(MaxConcurrentJobs) >= ConcurrentJobs
then ConcurrentJobs else values(ConcurrentJobs) end;
But the above query doesn't work as expected. It always updates the value 2300
in the concurrent jobs
column even if the condition fails. What could be the reason for this? Where does the query fail?