[postgis-users] Making unique rows after the import

Andy Colson andy at squeakycode.net
Wed Feb 29 13:30:19 PST 2012


On 2/29/2012 3:24 PM, Bob Pawley wrote:
> Hi
> After importing to postgis from a shapefile I have some rows duplicated.
> Is there a method of making all rows unique after the import.
> I tried identifying the rows with “select * where is not unique” without
> success.
> Bob
>

Do you have a column that is different between the two rows?

Are you wanting to delete all but one of the rows?

something like:

delete from table where id in (select min(id) from table group by 
anotherColumn having count(*) > 1);

Totally untested, by the way, I'm mostly guessing.

try the inside to make sure it returns just the rows you want deleted.

-Andy




More information about the postgis-users mailing list