I have a query such as:
SELECT *,
(A+B) AS TOTALVALUE
FROM
(SELECT A,B FROM MYTABLE) AS MYTABLE1
How can I use a case...when with the calculated value? For example, if my calculated value is greater than 1 I want it to be 10, otherwise I want it to return its value. How can i achieve that?
You might also want to consider
NULLs:EDIT: I’ve also simplified this bit:
as simply: