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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -