breadnbutter Posted March 30, 2006 Share Posted March 30, 2006 Hi GuysI'm pretty new to php but have been getting into it on and off over the past year. I pretty much am comfortable getting a search script going and coming back of the data base. But I am trying to think of a way to get php to find duplicats in certain columns and either display then, or only one of them.Its basically like the advanced filter tool in excel.I have a large DB that gets added to by multiple sources. Occasionaly info is entered in twice by different people and I need to create an online facility to then weed these out. Basically I need to look at 2 or three columns and look for entries that are the same. I've tried planning this out in my head, and I was wondering if there was a "same as" or "Equal to " syntax that may work. Quote Link to comment https://forums.phpfreaks.com/topic/6162-how-to-create-an-excel-like-filter/ Share on other sites More sharing options...
AV1611 Posted March 30, 2006 Share Posted March 30, 2006 if this is something your will do manually once in a while, I do something like this:[code]create table tablename select distinct * from thistable[/code]then I delete thistable and rename tablename to thistable Quote Link to comment https://forums.phpfreaks.com/topic/6162-how-to-create-an-excel-like-filter/#findComment-22269 Share on other sites More sharing options...
ober Posted March 30, 2006 Share Posted March 30, 2006 You could run something like this:[code]<?php$query = "SELECT field1, COUNT(field1) AS CntFROM tablenameGROUP BY field1HAVING (COUNT(field1) > 1) ";?>[/code]That assumes you can use the HAVING clause in your DBMS. Quote Link to comment https://forums.phpfreaks.com/topic/6162-how-to-create-an-excel-like-filter/#findComment-22283 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.