表中有A B C三列,用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列。
select (case when a>b then a else b end),
(case when b>c then b esle c end)
from table_name
赞
踩
select (case when a>b then a else b end),
(case when b>c then b esle c end)
from table_name
转载于:https://www.cnblogs.com/wangchuang/archive/2013/04/12/3016298.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。