sql - remove duplicate rows based on date column or other column
igweMay 17 2012 — edited May 17 2012Hello people, is it possible to select the latest row per column for a query:
say my query returns:
book_id, date, price
===========
19,10-JAN-2012,40
19,16-MAY-2012,35
18,10-MAY-2012,21
And I want it to return
book_id, date, price
===========
19,16-MAY-2012,35
18,10-MAY-2012,21
That is, the book_id 19 shows up twice initially but I now return the latest version of it (based on the date column) along with any other rows that do not have duplicates.
Is it possible to do this?
Many Thanks