Using CASE Statements In A SQL UPDATE Query
user following CASE statement:
- <code>
- UPDATE [account]
- SET
- balance =
- (
- CASE
- WHEN ((balance - 10.00) < 0)
- THEN 0
- ELSE (balance - 10.00)
- END
- )
- WHERE
- id = 1
- </code>