表中有A B C三列,用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列
1个回答
展开全部
select
case
when first_name>middle_name then
case when first_name>last_name then first_name
else last_name end
else
case when middle_name>last_name then middle_name else last_name
end
end as name
from member
case
when first_name>middle_name then
case when first_name>last_name then first_name
else last_name end
else
case when middle_name>last_name then middle_name else last_name
end
end as name
from member
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询