您的位置:首页 > 数据库 > Oracle

oracle取一条记录中多个列的最大值和最小值

2017-04-17 10:06 357 查看
1.使用oracle内置的greatest()和least()函数,具体示例如下:

select 5 as col1,6 as col2,9 as col3,1 as col4 from dual;

--------------------------------------

col1 | col2 |col3 |col4

5 6 9 1

select greatest(5,6,9,1) as maxcol, least(5,6,9,1) as mincol from dual;

--------------------------------------

maxcol | mincol

9 1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: