用SQL语句书写,当A>B时,选择A,否则B,当B>C时,选择B,否则C
解决方案 »
- 求一SQL語句..
- ms-sql 2000 计划任务问题(Job)
- Sql Server 2008 行列转换 不会用case when?
- SQL 查询相加显示的问题。
- 请大帮忙
- SQL20008 跨服查询 SQL2000的数据 两个库的表字段有关联的。
- 3个数据库 25G内存,笔记本跑得起来么
- 请教:如何在三张表中取数据
- 一个理解不是很清楚的概念问题:there is an N before the start of the string, which indicates that the data following the N is Uni
- 两个表的关联查询(问题长点,多多包涵)
- 字段命名问题,外键的命名
- 表建立的似乎有问题,请教
insert @t
select 1,5,3 union
select 4,0,2 union
select 6,2,9select Val=(case when A>B then A when B>C then B else C end)
from @tVal
-----------
5
4
6(3 行受影响)
select case when A>B then A
when B>C then B else C res
from tb
不过感觉这个逻辑不严密。
select
case when A>B then A else B END as '列值1',
case when B>c then B else C end as '列值'
from tb
select case when a > b then a else b end,
case when b > c then b else c end
from tb
insert @t
select 1,5,3 union
select 4,0,2 union
select 6,2,9select Val=(case when A>B then A when B>C then B else C end)
from @t