Re: php/MYSQL remove duplicate records

From: Date: Thu, 16 Sep 2004 03:27:30 +0000
Subject: Re: php/MYSQL remove duplicate records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196814@lists.php.net to get a copy of this message
I do that a lot using Microsoft Access. I just finished on a project where I had to eliminate duplicates from each of three or more queries, a couple of which have three keys. However I am not much more experienced han you are; Microsoft Access generates SQL for us so I am not sure what the SQL looks like. This is actually a SQL question; I think it can be solved entirely by SQL. However I don't know and it is not my responsibility to decide such things. You can (should) sort by email address of course. Then there is a function for getting the count of a field. The result will be records with the email address occuring only once. The following I think is a simplified version of something I have done: SELECT ITEMNO, COMP1, COMP2, Count(COMP2) AS CountOfCOMP2 FROM CostsMerge GROUP BY ITEMNO, COMP1, COMP2; However I have another duplicates removal query that uses "Last" but not "Count", as in: SELECT Item, Comp1, Comp2, Last(Comp1Q), Last(Comp2Q) INTO MergedData FROM Merge GROUP BY ITEMNO, COMP 1, COMP 2; In both of the above, there are three keys: Item, Comp1 and Comp2; whereas you have just one key, the email address. "Dustin Krysak" <mailinglists@digitalcollision.com> wrote in message news:40D0BFDB-06A5-11D9-AEC3-000A95902366@digitalcollision.com... > Hi there - I have an extremely simple table that has a unique Id and an > email address..... what I am looking for is an example of a PHP script > that will poll the MYSQL database and delete the duplicate records leaving > only 1 unique (email) record. > > can someone point me to the right place? > > thanks! > > d

« previous php.general (#196814) next »