Hi, I need your help.
I need to change the value 999999999 for xxx when the condition is meet
case
when U_Importacion != 'S' then price
[color=Yellow]when (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.25) then 999999999[/color]
when (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.5) then (round(T4.Avgprice * 1.05/1000,0)*1000)
when (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.6) then (price * 0.5)
when (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.7) then (price * 0.7)
when (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.8) then (price * 0.8)
when (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.9) then (price * 0.9)
else price
end
Comments
hard to tell exactly what you're trying to do, but you probably want to use something like:
UPDATE (tablename)
SET (fieldname) = '9999999999'
WHERE U_Importacion != 'S' AND
(
(((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.25)
OR
(((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.5)
OR (round(T4.Avgprice * 1.05/1000,0)*1000)
OR (((datediff(day,getdate(), t1.expdate)/30.00) /U_Prometido) <= 0.6)
)