You are here: Re: Help with a Query « PHP SQL « IT news, forums, messages
Re: Help with a Query

Posted by Stefan Rybacki on 11/29/05 13:29

Brian wrote:
> Hi there
>
> I'm trying to work out how to run a query
> that checks if there are duplicated records
> in a table and then have to run a query to
> delete them (need to check if there are
> an duplicates before I delete them)
>
> the 3 fields to use as the test would be
> product, description, dnote
>
> any help / advice?

Just do a grouping over those three attributes and count the group members.

SELECT * FROM table GROUP BY product, description, dnote HAVING count(*)>1

For deletion you could use this as subquery (mysql >4.1) or a temporary table with which
you join in the delete statement.


Regards
Stefan


>
> Brian
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация