Skip to content
Advertisement

Set column value of a view based on which table I’m selecting from

I’m creating a view from 2 tables. I need to create a brand new column in the view; this column must be set to 0 when I’m selecting from the first table, 1 from the second one:

Advertisement

Answer

Just use a union with a computed column:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement