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.
Loading
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.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Jul 18, 2022, 2:43 PM
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 SontakkePosted Jul 18, 2022, 2:30 PM