Question

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!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top