MySQL database search help wanted

by 4 replies
5
I would like to be able to perform a search in my
MySQL database to find duplicate articles submitted
to my site.

The following code appears to work but I would like to limit
the amount of characters the search checks to save straining
the server, if possible.

SELECT COUNT(*), textArticleText FROM tblarticles
GROUP BY textArticleText
HAVING COUNT(*)>1;

Has anyone any idea how to limit the characters searched.

Any help appreciated.

Thanks

Terry
#programming #database #mysql #search #wanted
  • In the select you could chop the left most, say, 20 characters off the article text string, eg
    PHP Code:
    SELECT COUNT(*), LEFT(textArticleText,20) as chopped FROM tblarticles
    GROUP BY chopped
    HAVING COUNT
    (*)>1
    I'm not sure if that would add to the server overhead though!
  • Hi,
    The following code will be useful in detecting the dublicate articles
    Code:
    SELECT DISTINCT column1 from table
    group by column1 HAVING count(column1) > 1
    • [1] reply
    • Thanks to all of you
      for your suggestions.

      Terry

Next Topics on Trending Feed