My Query :-
SELECT
p.*,
b.brand_name
FROM
portfolio p,
branding_category b
WHERE
p.category = 'BRANDING'
AND
p.brand_category = b.id
AND
is_active = '1'
GROUP BY
p.brand_category
ORDER BY p.id DESC
LIMIT 10
Suppose portfolio table has :-
id category brand_category is_active title
1 test 8 1 abc
2 test 7 1 pqr
3 test 8 1 xyz
4 test 7 1 ijk
And I want to show Output has :- That is, the last record in each group should be returned.
id category brand_name is_active title
3 test Catalogs 1 xyz
4 test Posters 1 ijk
Edit :-
branding_category
id brand_name
8 Catalogs
7 Posters
i.e, Last row for each group. Please help me on this. I know it is there in stackoverflow Retrieving the last record in each group but I am not able to write for two table.