We help IT Professionals succeed at work.

A T-SQL CASE like question

I need to write a query in the store procedure.

My table columns:
id,
...
model1,
model2,
model3,
...

Earch row has one of the three has a value and the rest two are null.
eg. if a row has a value on model1 column, model2 and model3 have null values.

I want to write query select some columns, and for model property column, only pick up the model column that has a value.

How can I write it? Thanks.
Comment
Watch Question

Commented:
select id,coalesce(model1,model2,model3)
from table

Author

Commented:
Thanks.