how do I select a column based on condition?

Viewed 113626

I have a variable called @status which I set before this select statement:

Select
ordr_num as num,
ordr_date as date,
ordr_ship_with as shipwith
From
order
where ordr_num = @ordrNum

I only want to select ordr_ship_with column if @status <> 'Cancelled', otherwise I want to select null for shipwith. How do I accomplish this?

5 Answers
Related