I am using Postgres SQL and I would like to return the rows which has the greatest seq number.
Eg:
row_name, seq, data
row1, 1, abc
row1, 2, def
row2, 1, hij
row2, 2, klm
row2, 3, nop
I want the result to be :
row1, 2, def
row2, 3, nop
I am using:
SELECT * FROM table_name where seq = (SELECT MAX(seq) from table_name)
but it is returning only row2, 3, nop.
Please help thanks.