当前位置:网站首页>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 .
边栏推荐
- [web security] - [SQL injection] - error detection injection
- How can technology managers quickly improve leadership?
- [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
- Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
- Explore Netease's large-scale automated testing solutions see here see here
- 什么是质押池,如何进行质押呢?
- Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
- 远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
- Svn usage specification
- Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
猜你喜欢
跟我学企业级flutter项目:简化框架demo参考
Mysql 单表字段重复数据取最新一条sql语句
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
Détails du contrôle de la congestion TCP | 3. Espace de conception
Visual SLAM algorithms: a survey from 2010 to 2016
0214-27100 a day with little fluctuation
NSQ源码安装运行过程
[web security] - [SQL injection] - error detection injection
[proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
Netease UI automation test exploration: airtest+poco
随机推荐
MongoDB 的安装和基本操作
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
中南大学|通过探索理解: 发现具有深度强化学习的可解释特征
Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
面试之 top k问题
Register in PHP_ Globals parameter settings
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
[combinatorics] combinatorial identity (sum of variable upper terms 1 combinatorial identity | summary of three combinatorial identity proof methods | proof of sum of variable upper terms 1 combinator
QT serial port UI design and solution to display Chinese garbled code
Golang 装饰器模式以及在NSQ中的使用
Expression of request header in different countries and languages
8 cool visual charts to quickly write the visual analysis report that the boss likes to see
Détails du contrôle de la congestion TCP | 3. Espace de conception
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
[combinatorics] combinatorial identity (sum of combinatorial identity products 1 | sum of products 1 proof | sum of combinatorial identity products 2 | sum of products 2 proof)
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
Pointcut expression
pycharm错Error updating package list: connect timed out
How can technology managers quickly improve leadership?
Myopia: take off or match glasses? These problems must be understood clearly first