Edward W. Rouse <erouse@comsquared.com> wrote:
> Is there any way to remove a duplicate row from a table? Not my db but I have
> to work with it. On version 7.4 right now.
>
How to select the right records?
You can try to use the ctid-column, see my simple example:
test=# select * from dups ;i
---1112234
(7 Zeilen)
Zeit: 0,145 ms
test=*# delete from dups where (ctid, i) not in (select max(ctid), i from dups group by i);
DELETE 3
Zeit: 0,378 ms
test=*# select * from dups ;i
---1234
(4 Zeilen)
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°