|
Hm on second thoughts :)
That removes all the records that are duplicated, whereas
you want to keep the first record but delete the remaining ones...
Apologies for the misunderstanding. <AMNESIA DUST IN
THE FACE>
Looking at the most excellent page mentioned previously,
http://www.sqlteam.com/item.asp?ItemID=3331 -
if you have an ID field that has the same value for each group of duplicated
records, you wont need to group on every field - grouping on your ID field will
be sufficient.
Aaron
----- Original Message -----
From: Aaron DC
Sent: Wednesday, June 09, 2004 12:08 PM
Subject: [cfaussie] Re: How can I remove duplicate records in SQL
Server 2000? Hi George
Would something like the following work for
you?
DELETE
FROM YourTable WHERE YourID IN
(SELECT YourID
FROM YourTable
GROUP BY YourID
HAVING COUNT(YourID) > 1)
HTH
Aaron
----- Original Message -----
From: George Lu
Sent: Wednesday, June 09, 2004 9:07 AM
Subject: [cfaussie] How can I remove duplicate records in SQL Server
2000? Somehow I don't know what happened I've got duplicate records (two records have same value in all fields including ID). I can't set primary key since ID field is duplicated. Could anyone tell me how to remove the duplicate record or merge two duplicated records into one in SQL or CF? Thanks, George --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ AMES (Adult Multicultural Education Services) www.ames.net.au Disclaimer ********************************************************************** This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments you should check them for viruses or defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of Adult Multicultural Education Services (AMES). ********************************************************************** --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ |
- [cfaussie] Re: How can I remove duplicate records in SQL Se... Phil Evans
- [cfaussie] Re: How can I remove duplicate records in S... Aaron DC
- [cfaussie] Re: How can I remove duplicate records in S... Aaron DC
- [cfaussie] Re: How can I remove duplicate records in S... Steve Onnis
- [cfaussie] Re: How can I remove duplicate records in S... Aaron DC
- [cfaussie] Re: How can I remove duplicate records in S... Peter Tilbrook
