dimanche 29 novembre 2015

SQL Server 2005 : update the status column by comparing two values

I have a table where I have to check the values between column Value1 and value2. If value1 is less than value2, update the status 'Low' in Status column, if greater then update status to 'High'.

Table Screenshot

I have tried with this query

UPDATE table 
SET Status = If(value1 <= value2) Then 'Low' else 'High'

Please guide to a solution.

Aucun commentaire:

Enregistrer un commentaire