Hi I have a table like below, There are more than one data for same serial no, I wanna see only the last data for each serial no and tag=a.
How can I get this result.
I wanna see only the last data for each serial no and tag=a
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Rajanikant HawaldarRank #107 · 20.6K reputationPosted Jul 18, 2022, 10:43 AM EDT
Share your table name it's details,trt as below
SELECT DISTINCT ON ( "serial" ) * FROM "table" WHERE "tag" = 'a' ORDER BY "serial", "date_inserted" DESC
Nitin SontakkeRank #264 · 9.6K reputationPosted Jul 18, 2022, 10:30 AM EDT