Jump to content


This topic is now archived and is closed to further replies.


How to create an excel like filter?

Recommended Posts

Hi Guys

I'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.

Share this post

Link to post
Share on other sites
if this is something your will do manually once in a while, I do something like this:

create table tablename select distinct * from thistable
then I delete thistable and rename tablename to thistable

Share this post

Link to post
Share on other sites
You could run something like this:
$query = "SELECT     field1, COUNT(field1) AS Cnt
FROM         tablename
GROUP BY field1
HAVING      (COUNT(field1) > 1) ";

That assumes you can use the HAVING clause in your DBMS.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.