Jump to content

Check for duplicates in a MySQL database


Pythondesigns

Recommended Posts

you can group them by url:

"select count(*) as count, url from table group by url";

returned results contains 2 column: count and url.
count contain the number of repetition of url.

you can use this result to find out the id contain repeated url:
"select id where url='repeated_url'";
[quote author=hvle link=topic=100562.msg396988#msg396988 date=1152884904]
you can group them by url:

"select count(*) as count, url from table group by url";

returned results contains 2 column: count and url.
count contain the number of repetition of url.

you can use this result to find out the id contain repeated url:
"select id where url='repeated_url'";
[/quote]

To get just the duplicates

"select count(*) as count, url from table group by url having count > 1";

Archived

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

×
×
  • Create New...

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.