Table=check_group_by id group_by value ------------------------- 1 1 Value 1 2 1 Value 2 3 1 Value 3 4 2 Value 4 5 2 Value 5 6 3 Value 6 Query will be as like: SELECT id,group_by,value FROM check_group_by WHERE id IN ( SELECT MAX(id) FROM check_group_by GROUP BY group_by )
SQL Fiddle Example
No comments:
Post a Comment