MySQL latest recording date of each common SQL query formatting and duplicate data packets taken after

     Edit " Common SQL query the date format and duplicate data " create table test1 time, the test data modified as follows:

 

    After each group grouped by name extract the newly created record:

SELECT a.* FROM test1 AS a, 
(SELECT b.`name`, MAX(b.create_time) AS `create_time` FROM test1 AS b GROUP BY b.`name`)
AS c WHERE a.`name`=c.`name` AND a.create_time = c.create_time ;

 

    After execution, the result set as shown below:

 

Guess you like

Origin www.cnblogs.com/east7/p/11587473.html