当前位置:网站首页>MySQL single table field duplicate data takes the latest SQL statement
MySQL single table field duplicate data takes the latest SQL statement
2022-07-03 16:29:00 【Xiao Chen - Programmer】
Mysql Take the latest one for the duplicate data in a single table sql sentence
We often sql Query some related data contents in the statement . Solution we can use grouping and max(). But this method will produce null The problem of . So we can use not exists To perform .
scene : Get the latest data of users in the list
solve
utilize not exists
select * from temp t where not exists(select 1 from temp t2 where t.userId = t2.userId and t2.tm_create_date > t.tm_create_date)
result :
summary :
Try many ways , Strive to master the method that best meets the needs .
边栏推荐
- 什么是质押池,如何进行质押呢?
- [combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
- How programming apes grow rapidly
- Pointcut expression
- Mysql 将逗号隔开的属性字段数据由列转行
- The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
- PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
- Learn from me about the enterprise flutter project: simplified framework demo reference
- Unreal_ Datatable implements ID self increment and sets rowname
- 1287. Elements that appear more than 25% in an ordered array
猜你喜欢
Multithread 02 thread join
First knowledge of database
Myopia: take off or match glasses? These problems must be understood clearly first
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Record a jar package conflict resolution process
NSQ源码安装运行过程
Remote file contains actual operation
The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
QT串口ui设计和解决显示中文乱码
TCP擁塞控制詳解 | 3. 設計空間
随机推荐
Record windows10 installation tensorflow-gpu2.4.0
ThreeJS 第二篇:顶点概念、几何体结构
初试scikit-learn库
Register in PHP_ Globals parameter settings
MongoDB 的安装和基本操作
From the 18th line to the first line, the new story of the network security industry
Develop team OKR in the way of "crowdfunding"
8 tips for effective performance evaluation
Svn usage specification
TCP拥塞控制详解 | 3. 设计空间
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
《天天数学》连载56:二月二十五日
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
一台服务器最大并发 tcp 连接数多少?65535?
Cocos Creator 2. X automatic packaging (build + compile)
Characteristic polynomial and constant coefficient homogeneous linear recurrence
Construction practice camp - graduation summary of phase 6
特征多项式与常系数齐次线性递推