Friends, I need help.
I have these 2 queries:
UPDATE leilaov
SET seconds = CASE
WHEN (mesini = MONTH(NOW()) AND diaini = DAYOFMONTH(NOW()) AND horaini = HOUR(NOW()) AND minutoini <= MINUTE(NOW()))
OR (mesini = MONTH(NOW()) AND diaini < DAYOFMONTH(NOW()))
OR (mesini = MONTH(NOW()) AND diaini = DAYOFMONTH(NOW()) AND horaini < HOUR(NOW()))
OR (mesini < MONTH(NOW())) THEN seconds-1
END
WHERE numero12345 = 1
UPDATE leilaov
SET seconds = IF((mesini = MONTH(NOW()) AND diaini = DAYOFMONTH(NOW()) AND horaini = HOUR(NOW()) AND minutoini <= MINUTE(NOW()))
OR (mesini = MONTH(NOW()) AND diaini < DAYOFMONTH(NOW()))
OR (mesini = MONTH(NOW()) AND diaini = DAYOFMONTH(NOW()) AND horaini < HOUR(NOW()))
OR (mesini < MONTH(NOW())), seconds-1, seconds)
WHERE numero12345 = 1
Both work perfectly and there are no significant differences in runtime. The problem is that I need to update multiple fields, not just one.
What is the syntax for updating multiple fields? Will I have to repeat the condition for each field?
Should I use CASE or IF? Or is there a better option?
In advance thank you.