Reputation: 619
I have a table called apps with id, type, and group_id. The table has multiple group_id with same number. I need to get the max id for each group_id number where type equals 1.
My sql skills are not so good. Any help is greatly appreciated
Upvotes: 0
Views: 374
Reputation: 7807
select group_id, max(id) as max_id
from apps
where type = 1
group by group_id
Upvotes: 6