문제

I would like to create a view that selects ALL columns in a table, then creates/adds an additional "columnX" based on the value of another column in that same table.

For example if [column1] IS NULL, I would like [columnX] = 0 (zero) and if [column1] IS NOT NULL, I would like [columnX] = [column1]

I think this should be simple, but I cannot seem to find the solution. Can anyone please help? Thanks!

도움이 되었습니까?

해결책

case when col1 is null then 0 else col1 end as COLUMNX

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top