Select Value1,Value2,Value3 from Table1 where time > DATEADD(DAY,-2,GETDATE())
ordery BY time desc
Result :
Value1=25
Value2=50
Value3=70
How can I change result to be
Value1=25
Value2=0 (if Value2=50 it will be 0)
Value3=70
If I understand you correctly, you can use CASE statement,
SELECT Value1,
CASE WHEN Value2 = 50 THEN 0 ELSE Value2 END Value2,
.....
value2 to determine which value to output from the CASE statement. So it's going to require further processing, causing execution time to increase.