当前位置:网站首页>纵向求最大最小与横向求最大最小greatest(),least(),max(),min()
纵向求最大最小与横向求最大最小greatest(),least(),max(),min()
2022-06-22 05:47:00 【微亮之海】
greatest (a,b,c,d,e)
greatest 求的是某几列的最大值,横向求最大(一行的多列记录求最大)
注意:a,b,c,d,e列中不能出现null值,否则greatest()返回值为null值
select
greatest(
nvl(substr(a.update_time,1,10),0),nvl(substr(b.dt_editdate,1,10),0),nvl(substr(coalesce(c.editdate,c.adddate),1,10),0)
,nvl(substr(e.update_time,1,10),0),nvl(substr(f.update_time,1,10),0),nvl(substr(g.update_time,1,10),0)) update_time
from statistics.corp_basic_info_ods a
left join usercenter.ucenter_company_ods b on a.tax_num = b.c_taxnum
left join orderdb.orders_ods c on a.tax_num = c.buyer_taxnum
left join statistics.corp_deliver_config_info_ods e on a.tax_num = e.tax_num
left join statistics.corp_equip_invoice_ods f on a. tax_num = f.taxnum
left join statistics.corp_equip_invoice_sub_client_ods g on f.id = g.invoice_equipment_id
least(a,b,c,d,e)
求多列中的最小值,横向求最小
注意:a,b,c,d,e列中不能出现null值,否则greatest()返回值为null值
max(a)
求a列中的最大值
纵向求最大(一列的多行记录求最大)
min(a)
求a列中的最小值
纵向求最小(一列的多行记录求最小)
边栏推荐
- vscode极简安装教程
- 不务正业系列7:老照片去除斑点手法
- Bat common batch script record
- C#中的泛型
- 402 string (Title: Sword finger offer58 ii. left rotation string, 28. implementation of strstr(), 459 Repeated substrings)
- SQLServer中的子查询
- C#中的数组及Foreach遍历
- [soft test] senior system architecture designer learning experience sharing
- Matlab system identification
- MFC tabctrl control to modify label size
猜你喜欢

Serial port (RS - 232)

Unity app提高设备可用性

Conversion between gray code and binary

Design input of Oracle project management system

An unordered array of N integers. Find the first number after each element that is larger than it. The time complexity is O (n)

EPP (Enhanced Parallel Port 增强型并口)

Creating GLSL Shaders at Runtime in Unity3D

SSM整合所需配置文件及常见配置错误引起的报错

What about computer jam?

Trigger
随机推荐
Air conditioning (daily question 50 in spring)
生信可视化(part4)--相关性图
为Cortex-M4编写优化的DSP代码
MFC Tab 控件添加 icon 图标
舰载机自动着舰控制系统研究
Bat 常用批处理脚本记录
Read and understand the four deep learning methods of supervised learning, unsupervised learning, semi supervised learning and intensive learning
Unity app improves device availability
simulink中搭建专家pid控制
【Rust笔记】01-基本类型
JTAG接口
【雲計算重點複習】
单细胞论文记录(part9)--Spatial charting of single-cell transcriptomes in tissues
u盘作为启动盘重装win10系统(无需其他软件)
单细胞论文记录(part12)--Unsupervised Spatial Embedded Deep Representation of Spatial Transcriptomics
服务器php相关网页开发环境搭建
格雷码与二进制的转换
小熊派BearPi-HM Micro正式合入OpenHarmony主干
以太网通信协议
Performance optimization best practices for reducing Game Size