当前位置:网站首页>MySQL group query to obtain the latest data date function of each group
MySQL group query to obtain the latest data date function of each group
2022-06-12 06:36:00 【Little white rabbit】
mysql Group query , Get the latest data of each group , If there are duplicates in the data, the latest data obtained by each group has multiple identical
select e1.* from
(SELECT `name`,max(datatime) datatime from e_air group by `name`) e2
left join e_air e1 on e1.`name` = e2.`name` and e1.datatime = e2.datatime
select e1.*
from
(SELECT `name`,max(datatime) datatime from e_air group by `name`) e2 ,e_air e1
where e1.`name` = e2.`name` and e1.datatime = e2.datatime
https://blog.csdn.net/ruanchengshen/article/details/120840215
Date function :
date_format(‘time’, ‘%Y-%m-%d %H:%i:%s’) STR_TO_DATE(startTime,’%Y-%m-%d %H:%i:%s’)
MySQL DATE_FORMAT():https://www.w3school.com.cn/sql/func_date_format.asp
边栏推荐
- Apache poi 导入导出Excel文件
- Get the size of the picture
- PHP一句话木马深度详细剖析
- 使用 ms17-010 永恒之蓝漏洞对 win7 进行渗透及建立永久后门
- AI operation ch8
- LeetCode-419. Battleship on deck
- Reentrantlock underlying AQS source code analysis
- 张驰课堂:2022年CAQ中质协六西格玛考试时间通知
- Tomato learning notes-stm32 SPI introduction and Tim synchronization
- June training day 6 - sliding window
猜你喜欢

Introduction to the method of diligently searching for the alliance procedure

AI作业ch8

丢掉丑陋的 toast,会动的 toast 更有趣

Opencv_100问_第五章 (21-25)

leetcode 704. Binary search

PHP read / write cookie

Multithreading (4) -- no lock (3) -- longadder source code

Automatic modeling of Interchange

It only takes 10 minutes to understand the underlying principle of NiO

Multithreading mode (I) -- protective pause and join source code
随机推荐
The difference between get and post and the code implementation of message board
Mastering UI development with unity
Single channel picture reading
Redis problem (I) -- cache penetration, breakdown, avalanche
SQL injection read / write file
Reentrantlock underlying AQS source code analysis
Introduction to the method of diligently searching for the alliance procedure
PHP read / write cookie
LeetCode-1873. Calculate special bonus
Computer composition and design work06 - based on MIPS
Set [list] to find out the subscript of repeated elements in the list (display the position of the subscript)
LeetCode-1490. Clone n-ary tree
Redis distributed lock
English grammar_ Adverb_ With or without ly, the meaning is different
Multithreading (4) -- no lock (3) -- longadder source code
Excel VBA opens a file that begins with the specified character
ConVIRT论文详解(医疗图片)
PDF. JS help file
Install MySQL tutorial
Zhang Chi: is process a panacea?