T-SQL Conditonal Select Statement

Posted by msarchet on Stack Overflow See other posts from Stack Overflow or by msarchet
Published on 2010-06-07T21:14:00Z Indexed on 2010/06/07 21:22 UTC
Read the original article Hit count: 269

Filed under:

So this isn't really a normal conditional select statement. I'm helping a colleague out with some SQL and we have this issue.

I current there is a coulumn ID and a column Number. Either ID is 0 or Number is 0.

So my select statement needs to do Select colA, colB, colC, crazy part From Table A.

the crazy part is this: (If ID > 0, ID, Number) basically select and return that column that isn't 0. Is there any way to do this in T-SQL?

© Stack Overflow or respective owner

Related posts about tsql