Skip site navigation (1) Skip section navigation (2)

Re: point types in "DISTINCT" queries

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: "Jonathan S(dot) Katz" <jonathan(dot)katz(at)excoventures(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: point types in "DISTINCT" queries
Date: 2011-06-29 15:58:20
Message-ID: 1309363100.10707.134.camel@jdavis (view raw or flat)
Thread:
Lists: pgsql-general
On Wed, 2011-06-29 at 11:37 -0400, Jonathan S. Katz wrote:
> Which means it *should* work, but first I would need to clean up the data and find the duplicates.  I was hoping this might work:
> 
> 	SELECT geocode, count(*)
> 	FROM a
> 	GROUP BY a.geocode
> 	HAVING count(*) > 1;

Maybe you could use a self-join as a workaround for now, just to clean
up the data?

SELECT geocode, other_columns from a a1, a a2 where a1.other_columns <>
a2.other_columns and a1.geocode ~= a2.geocode;

Regards,
	Jeff Davis


In response to

Responses

pgsql-general by date

Next:From: Grace BatumbyaDate: 2011-06-29 16:14:00
Subject: Windows x64 : How do I get OSSP-UUID.sql contrib for postgresql x64
Previous:From: David JohnstonDate: 2011-06-29 15:50:32
Subject: Re: Real type with zero

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group