Select distinct rows with max date in mysql 5.7 [duplicate]
问题 This question already has answers here : SQL select only rows with max value on a column [duplicate] (27 answers) Closed 7 months ago . Suppose having query SELECT c_id, id, max(date) as max_date FROM table GROUP BY c_id,updated And following result: c_id, id, max_date 1 5 2017-12-28 16:09:20 1 6 2019-12-28 16:09:20 2 7 2017-12-28 16:09:20 2 8 2019-12-28 16:09:20 I expect to get: c_id, id, max_date 1 6 2019-12-28 16:09:20 2 8 2019-12-28 16:09:20 How to achieve that in mysql 5.7? 回答1: Use a