Query for duplicate records

------=_NextPart_000_007F_01CB6E13.C2488E40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Is there a query you could help me write a SELECT query that would =
search table `ministry_profiles` for where column `organization` has =
the same organization more than once? I am trying to delete the =
duplicate organization records, but I am working with 1,000+ businesses =
and I can't go through each record looking for duplicates.

------=_NextPart_000_007F_01CB6E13.C2488E40--
ron.piggott [ So, 17 Oktober 2010 21:55 ] [ ID #2049283 ]

Re: Query for duplicate records

On 18/10/10 06:55, Ron Piggott wrote:
> Is there a query you could help me write a SELECT query that would search table `ministry_profiles` for where column `organization` has the same organization more than once? I am trying to delete the duplicate organization records, but I am working with 1,000+ businesses and I can't go through each record looking for duplicates.

select organization, count(*) from ministry_profiles group by
organization having count(*) > 1;

gives you which organization has more than 1 account (and how many
duplicates you are dealing with).

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
dmagick [ Mo, 18 Oktober 2010 00:14 ] [ ID #2049300 ]
PHP » gmane.comp.php.database » Query for duplicate records

Vorheriges Thema: Books
Nächstes Thema: Escaping an '