I am trying to run this update but it only updates the "value" column if the "discount" column is different from 0.00. If it is 0.00 it enters the second condition of the IF and places the value of itself in value. If it is different it does the calculation_original_value - discount. Can anyone help me understand why this is occurring?
UPDATE pagamento
SET
valor = IF(caminho = '2',valor_original - desconto, valor)
WHERE
codigo = 5