> -----Original Message----- > From: Jay Blanchard [mailto:jblanchard@xxxxxxxxxx] > Sent: Friday, February 23, 2007 1:51 PM > To: Wikus Möller; php-general@xxxxxxxxxxxxx > Subject: RE: Getting Similar rows from db > > [snip] > I need a script that selects all similar rows from a database. Like > only the id would differ, but other fields would be the same as other > rows's fields. > > I don't know if there is such a mysql statement like SELECT SIMILAR ... > > Please assist me with using the right mysql statement or using php to > get similar rows from the db. > [/snip] > > See http://www.mysql.com/like > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Assume you have the following data: ID FirstName LastName 1 John Doe 2 John Doe 3 Jack Black 4 Adam Jones 5 Sally Smith The following query: SELECT COUNT(ID) AS NumRecords, FirstName, LastName FROM MyTable GROUP BY FirstName, LastName HAVING COUNT(ID) > 1; Would produce the following result: NumRecords FirstName LastName 2 John Doe HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php