当前位置:网站首页>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 .
边栏推荐
- [proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
- 在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
- 记一次jar包冲突解决过程
- 手机注册股票开户安全吗 开户需要钱吗
- 爱可可AI前沿推介(7.3)
- Construction practice camp - graduation summary of phase 6
- 0214-27100 a day with little fluctuation
- SVN使用规范
- Develop team OKR in the way of "crowdfunding"
- 无心剑中译泰戈尔《漂鸟集(1~10)》
猜你喜欢
Mysql 单表字段重复数据取最新一条sql语句
Explore Cassandra's decentralized distributed architecture
初试scikit-learn库
How to use AAB to APK and APK to AAB of Google play apps on the shelves
[web security] - [SQL injection] - error detection injection
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
Data driving of appium framework for mobile terminal automated testing
Getting started with Message Oriented Middleware
随机推荐
[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
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
nifi从入门到实战(保姆级教程)——flow
pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
Thinking about telecommuting under the background of normalization of epidemic | community essay solicitation
跟我学企业级flutter项目:简化框架demo参考
How programming apes grow rapidly
Construction practice camp - graduation summary of phase 6
Visual SLAM algorithms: a survey from 2010 to 2016
【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
[redis foundation] understand redis persistence mechanism together (rdb+aof graphic explanation)
如何在本机搭建SVN服务器
探索Cassandra的去中心化分布式架构
AcWing 第58 场周赛
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
Pyinstaller is not an internal or external command, nor is it a runnable program or batch file
Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
Unreal_DataTable 实现Id自增与设置RowName
PHP CI (CodeIgniter) log level setting