>- see footer for list info -<
Paul,

What about SELECT DISTINCT Document_ID,ID

OR perhaps use GROUP BY Document_ID,ID 

My 2p

Alex

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Swingewood
Sent: 02 February 2006 15:22
To: [email protected]
Subject: [CF-Dev] Duplicate records

>- see footer for list info -<
I have a file that has duplicate records in it ... Aghhhhh (In fact
everything is duplicated at least once) Its an MS-SQL file. So to get rid of
the dupes I wrote this .....

<CFQUERY DATASOURCE="#Application.DocAdminDSN#" NAME="OuterLoop">
                SELECT Document_ID, ID
                FROM tbldetails
        </CFQUERY>


<cfoutput query="outerloop">
        <cfset tmp1=#Outerloop.Document_id#>
        <cfset tmp2=#OuterLoop.ID#>
        <cfloop index="x" from="1" to="1054">
        <CFQUERY DATASOURCE="#Application.DocAdminDSN#" NAME="InnerLoop">
                DELETE  FROM tbldetails
                WHERE   (document_id=#tmp1#) AND (ID <> #tmp2#)
        </CFQUERY>

</cfloop>
</cfoutput>


This is really not very good and as you can imagine once started I might as
well come back tomorrow to see if its finished .... Does anyone have a
better CF way of doing this ...? I can't get at the actual tables so it has
to be a CF solution....

Regards - Paul


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help 
>-<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to