当前位置:网站首页>PgSQL queries the largest or smallest data of a field in a group
PgSQL queries the largest or smallest data of a field in a group
2022-06-24 14:16:00 【GodSure0914】
As shown in the figure below , A one to many situation occurs after the left connection , I want to start from this " many " Take inside price The biggest piece of data :
terms of settlement , Add a new row to the query parameters :ROW_NUMBER() OVER(PARTITION by b.parent_charge_id ORDER BY c.price desc)idx
explain :
1.ROW_NUMBER: This function can number the groups
2.PARTITION by : Yes parent_charge_id This field is grouped
The query result is :
You can see that the data has been pressed id Grouped , And numbered , The number is 1 Is the maximum we want , And then the value is 1 We can get the result we want :
边栏推荐
- 杰理之串口接收 IO 需要设置数字功能【篇】
- 简谈企业Power BI CI /CD 实施框架
- 厨卫电器行业B2B交易协同管理平台开发,优化企业库存结构
- P2PDB 白皮书
- Overview of SAP marketing cloud functions (III)
- puzzle(016.2)指画星河
- leetcode:1504. 统计全 1 子矩形的个数
- Research on MySQL composite index
- 【从零开始学zabbix】一丶Zabbix的介绍与部署Zabbix
- 智源社区周刊#86:Gary Marcus谈大模型研究可借鉴的三个语言学因素;谷歌提出媲美Imgen的文生图模型Parti;OpenAI提出视频预训练模型VPT,可玩MC游戏
猜你喜欢

融云通信“三板斧”,“砍”到了银行的心坎上

Unit contour creation method

Win10 system problems

【无标题】

Convolution kernel and characteristic graph visualization

港股上市公司公告 API 数据接口

Second, the examinee must see | consolidate the preferred question bank to help the examinee make the final dash

百度地图API绘制点及提示信息

厨卫电器行业B2B交易协同管理平台开发,优化企业库存结构
![Maximum path sum in binary tree [handle any subtree, then handle the whole tree]](/img/d0/91ab1cc1851d7137a1cab3cf458302.png)
Maximum path sum in binary tree [handle any subtree, then handle the whole tree]
随机推荐
打败 二叉树!
Jerrys timer0 uses the default pa13 to detect the pulse width [chapter]
二造考生必看|巩固优选题库助力考生最后冲刺
智慧园区SaaS管理系统解决方案:赋能园区实现信息化、数字化管理
leetcode:1504. 统计全 1 子矩形的个数
MySQL日志管理、备份与恢复
食品饮料行业渠道商管理系统解决方案:实现渠道数字化营销布局
MIT-6.824-lab4A-2022(万字讲解-代码构建)
MES在流程和离散制造企业的15个差别(下)
HarmonyOS-3
v-for 中 key的作用和原理
OpenHarmony 1
百度地图API绘制点及提示信息
The function and principle of key in V-for
90% of the project managers have skipped the pit. Are you still in the pit?
Win10 system problems
AntD checkbox,限制选中数量
PM should also learn to reflect every day
Promotion of Project Manager
杰理之TIMER0 用默认的 PA13 来检测脉宽【篇】