Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

mysql select each last value group by

SELECT `tbl`.*
FROM my_table `tbl` , (SELECT MAX(`status_on`) `last_status_on`, status_id FROM my_table
GROUP BY `status_id`) `tbl_lasts`
WHERE `tbl`.`status_on` = `tbl_lasts`.`last_status_on`
Source by thispointer.com #
 
PREVIOUS NEXT
Tagged: #mysql #select #group
ADD COMMENT
Topic
Name
6+6 =