I have duplicate data in a table called bank_currency
that looks like this:
currencyid | bankid
--------------------
8 1
8 1
8 1
16 2
16 2
16 2
14 3
14 3
14 3
I have no idea why the data has been duplicated in triplicate, but I need to get rid of all the duplicates and keep only one of each row. So I end up like this:
currencyid | bankid
--------------------
8 1
16 2
14 3
I cannot ORDER BY
the bankid
or currencyid
to tell postgresql which row to keep, because they are duplicate. Perhaps an order by ROW_NUMBER
(if thats possible) and just keep the lowest ROW_NUMBER
? Any suggestions greatly appreciated.