user2023203
user2023203

Reputation: 556

SQL Server 2008 changing query value

In a query I want to present the employee's monthly salary. I want to present a salary of 1500 in the query if the result is below that, if not I want to keep the sum I got in the query.

Anyone know how to do that?

Upvotes: 0

Views: 52

Answers (2)

Alex Gordon
Alex Gordon

Reputation: 60751

select

case when salary<1500 then 1500 else salary end
, column2
,column3
from mytable

Upvotes: 0

Gordon Linoff
Gordon Linoff

Reputation: 1269873

The basic idea is to use a case statement. Something like this:

select (case when salary < 1500 then 1500 else salary end) as salary

Upvotes: 2

Related Questions