当前位置:网站首页>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 .
边栏推荐
- 爱可可AI前沿推介(7.3)
- Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
- 面试官:JVM如何分配和回收堆外内存
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
- Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
- Cocos Creator 2. X automatic packaging (build + compile)
- Deep understanding of grouping sets statements in SQL
- 2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
- [combinatorics] combinatorial identities (sum of variable terms 3 combinatorial identities | sum of variable terms 4 combinatorial identities | binomial theorem + derivation to prove combinatorial ide
- Pychart error updating package list: connect timed out
猜你喜欢

Unreal_DataTable 实现Id自增与设置RowName

QT serial port UI design and solution to display Chinese garbled code

TCP擁塞控制詳解 | 3. 設計空間

初试scikit-learn库

Mb10m-asemi rectifier bridge mb10m

爱可可AI前沿推介(7.3)

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

Myopia: take off or match glasses? These problems must be understood clearly first

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

The mixlab editing team is recruiting teammates~~
随机推荐
2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
用同花顺炒股开户安全吗?
Record windows10 installation tensorflow-gpu2.4.0
程序猿如何快速成长
疫情常态化大背景下,关于远程办公的思考|社区征文
Explore Netease's large-scale automated testing solutions see here see here
Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
QT串口ui设计和解决显示中文乱码
From the 18th line to the first line, the new story of the network security industry
1287. Elements that appear more than 25% in an ordered array
[combinatorics] combinatorial identities (sum of variable terms 3 combinatorial identities | sum of variable terms 4 combinatorial identities | binomial theorem + derivation to prove combinatorial ide
Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
From "zero sum game" to "positive sum game", PAAS triggered the third wave of cloud computing
EditText request focus - EditText request focus
(补)双指针专题
ThreeJS 第二篇:顶点概念、几何体结构
QT serial port UI design and solution to display Chinese garbled code
Aike AI frontier promotion (7.3)