当前位置:网站首页>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 :
边栏推荐
- [leetcode] 10. Regular expression matching
- Digital business cloud: strengthen supplier management and promote efficient collaboration between air transport enterprises and suppliers
- One click to generate University, major and even admission probability. Is it so magical for AI to fill in volunteer cards?
- Win10 system problems
- In the era of knowledge economy, it will teach you to do well in knowledge management
- 10 Ces autographes très stylisés.
- P2PDB 白皮书
- How to manage tasks in the low code platform of the Internet of things?
- Simulated 100 questions and answers of fluorination process examination in 2022
- Kotlin coordination channel
猜你喜欢

win10系统问题

leetcode:1504. Count the number of all 1 sub rectangles

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

The function and principle of key in V-for

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

Convolution kernel and characteristic graph visualization

How to solve the problem that iterative semi supervised training is difficult to implement in ASR training? RTC dev Meetup

杰理之TIMER0 用默认的 PA13 来检测脉宽【篇】

MySQL日志管理、备份与恢复

leetcode:1504. 统计全 1 子矩形的个数
随机推荐
Preliminary study on AQS
【LeetCode】10、正则表达式匹配
MES在流程和离散制造企业的15个差别(下)
Rasa 3. X learning series - it is a great honor to be a source code contributor of Rasa contributors, and to build and share the rasa community with rasa source code contributors all over the world!
谷歌WayMo提出R4D: 采用参考目标做远程距离估计
杰理之可能出现有些芯片音乐播放速度快【篇】
Kotlin shared mutable state and concurrency
conda和pip命令
Jericho After sleep, the system will wake up regularly and continue to run without resetting [chapter]
【Pytorch】量化
Halcon draw area into picture
P2pdb white paper
日常知识科普
Online text entity extraction capability helps applications analyze massive text data
Defoaming
Antd checkbox, limit the selected quantity
杰理之开了多种解码格式插卡到播放等待的时间长【篇】
pip uninstall all packages except builtin package
Method of establishing unity thermodynamic diagram
Overview of SAP marketing cloud functions (III)