当前位置: 代码迷 >> Sql Server >> sql有关问题Orz
  详细解决方案

sql有关问题Orz

热度:71   发布时间:2016-04-25 00:08:27.0
sql问题Orz
select a,b from table
出来结果是
a   b
XXX xxx
请问怎样让a b两列能只用1个列名表示
如
   c
XXX xxx 
------解决方案--------------------
select a+b as c from table

------解决方案--------------------
select a+b as c
------解决方案--------------------
select (case when a=某个条件 then a+b else a end),
case when a=某个条件 then null else b end
from tb
  相关解决方案