当前位置:网站首页>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] 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)
- Effect of ARP package on FTP dump under vxworks-6.6 system
- 探索Cassandra的去中心化分布式架构
- Construction practice camp - graduation summary of phase 6
- PHP中register_globals参数设置
- ThreeJS 第二篇:顶点概念、几何体结构
- 相同切入点的抽取
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)
- Learn from me about the enterprise flutter project: simplified framework demo reference
猜你喜欢

arduino-esp32:LVGL项目(一)整体框架

Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package

Unreal_DataTable 实现Id自增与设置RowName

于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日

Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..

Netease UI automation test exploration: airtest+poco

Visual SLAM algorithms: a survey from 2010 to 2016

From "zero sum game" to "positive sum game", PAAS triggered the third wave of cloud computing

QT serial port UI design and solution to display Chinese garbled code
![[redis foundation] understand redis master-slave architecture, sentinel mode and cluster together (Demo detailed explanation)](/img/1f/3dd95522b8d5f03dd763a6779e3db5.jpg)
[redis foundation] understand redis master-slave architecture, sentinel mode and cluster together (Demo detailed explanation)
随机推荐
2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
Mysql 单表字段重复数据取最新一条sql语句
在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
[combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
nifi从入门到实战(保姆级教程)——flow
Interviewer: how does the JVM allocate and recycle off heap memory
PHP中register_globals参数设置
LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
8 tips for effective performance evaluation
8 cool visual charts to quickly write the visual analysis report that the boss likes to see
Record windows10 installation tensorflow-gpu2.4.0
架构实战营 - 第 6 期 毕业总结
Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford
[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)
为抵制 7-Zip,列出 “三宗罪” ?网友:“第3个才是重点吧?”
Client does not support authentication protocol requested by server; consider upgrading MySQL client
PHP二级域名session共享方案
手机注册股票开户安全吗 开户需要钱吗
Threejs Part 2: vertex concept, geometry structure
NSQ源码安装运行过程