How about replace SELECT * with DELETE NCT_UPS_Import_Data_Totals. Quick guess, without analyzing what you are trying to do. And if that's not what you are trying to do, then explain your delete criteria a little better... it looks like you want to delete all duplicates from the NCT_UPS_Import_Data_Totals table, but leave the first record? Glenn Sullivan, MCSE+I MCDBA David Clark Company Inc. -----Original Message----- From: Matthew Studer [mailto:matthew_studer@xxxxxxxxxxx] Sent: Friday, November 22, 2002 11:24 AM To: windows2000@xxxxxxxxxxxxx Subject: [windows2000] MS SQL QUESTION: PLEASE HELP! I am trying to make these 2 statements (see below) into1 statement so it will find AND delete duplicate entries. I don't want to do each manually. It takes me too long to enter each value in that my select statement finds before deleteing it. But I can't just substitute DELETE for SELECT or it says: Server: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near '*'. Any ideas???? ************************************* ************************************* MS SQL SERVER VER 8.00 --UPS -- Step 1;This script will detect if any duplicates are in the NCT_UPS_Import_Data_Totals Table Select PackageReference2, count(PackageReference2)as 'TRANS' into ##TEMP1 from NCT_UPS_Import_Data_Totals group by PackageReference2 Select * from NCT_UPS_Import_Data_Totals A join ##TEMP1 B on A.PackageReference2 = B.PackageReference2 where B.TRANS <>'1' -- Step 2;Use this script to delete the desired duplicate by modifing the fields PackageReference2 and CODFrt Delete from NCT_UPS_Import_Data_Totals where PackageReference2 = 'MY INVOCE # GOES HERE' and CODFrt = 'MY NUMERIC VALUE FOR MY COD CHARGES GOES HERE' ---------------------------------------------------------------------------- STOP MORE SPAM with the new MSN 8[1] and get 2 months FREE* --- Links --- 1 http://g.msn.com/8HMDEN/2015 ================================== To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm ================================== To Unsubscribe, set digest or vacation mode or view archives use the below link. http://thethin.net/win2000list.cfm