sql server 2008 - SQL: Create new column with values that isn't in either columns -
i have table 22 appears either in or b:
a | b ---| --- 22 | 0 32 | 22 45 | 22 22 | 5
and want create new column table has value row isn't 22 e.g.
c - 0 32 45 5
how do this?
edit: table above comes statement
select a,b table (a = '22' or b = '22')
you can use case
expression generate output:
select case when 22 b else end c mytable 22 in (a, b)
Comments
Post a Comment