I need to query a table and select 3 of the values of 4 columns. I need to compare the values of the 3rd column and the fourth column and select the larger value.
For ex
In T-SQL the IF command is for programatic control. For example:
IF x THEN doSQLStatement1 ELSE doSQLStatement2
Within a SQL statement, you need CASE.
CASE WHEN a > b THEN a ELSE b END