当前位置:网站首页>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 :
边栏推荐
- [R language data science] (XIV): random variables and basic statistics
- 【从零开始学zabbix】一丶Zabbix的介绍与部署Zabbix
- 数据库一些基本操作(提供了原数据库信息)
- 杰理之串口接收 IO 需要设置数字功能【篇】
- Second, the examinee must see | consolidate the preferred question bank to help the examinee make the final dash
- Baidu map API drawing points and tips
- 【Pytorch】量化
- 杰理之红外滤波【篇】
- Return to new list
- Telecommuting: camping at home office gadgets | community essay solicitation
猜你喜欢

遠程辦公之:在家露營辦公小工具| 社區征文

P2PDB 白皮书

21set classic case

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

**Puzzling little problem in unity - light and sky box

HarmonyOS.2

厨卫电器行业B2B交易协同管理平台开发,优化企业库存结构
![[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX](/img/d1/4b21c8049f0377b54a18a9b267432e.png)
[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX

二造考生必看|巩固优选题库助力考生最后冲刺

打败 二叉树!
随机推荐
4个不可不知的“安全左移”的理由
MES在流程和离散制造企业的15个差别(下)
HarmonyOS.2
c语言---18 函数(自定义函数)
Mit-6.824-lab4a-2022 (ten thousand words explanation - code construction)
[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX
Zhiyuan community weekly 86: Gary Marcus talks about three linguistic factors that can be used for reference in large model research; Google puts forward the Wensheng graph model parti which is compar
P2pdb white paper
Development of B2B transaction collaborative management platform for kitchen and bathroom electrical appliance industry and optimization of enterprise inventory structure
MySQL复合索引探究
Baidu map API drawing points and tips
Method of establishing unity thermodynamic diagram
Jerry's seamless looping [chapter]
常见的单例模式&简单工厂
The difference between V-IF and v-show
2022 coal mine gas drainage operation certificate examination questions and simulation examination
Jerry's infrared filtering [chapter]
【无标题】
leetcode:1504. 统计全 1 子矩形的个数
杰理之检测 MIC 能量自动录音自动播放参考【篇】