MySQL distinct on one column with other max column -
let's have query:
select report_id, time_sent report_submissions report_id in (1,2,3,4,5,6) order report_id asc, time_sent desc
with result:
report_id time_sent 1 2 1 1 2 4 2 3 3 4
and want change query distinct report_id max(time_sent), example:
report_id time_sent 1 2 2 4 3 4
how do in efficient way? thanks.
select report_id, max(time_sent) report_submissions report_id in (1,2,3,4,5,6) group report_id order report_id asc
Comments
Post a Comment