Yeah I was a bit confused by that as well.  If it works, great.  Otherwise,
this is what I was suggesting, assuming that Id is the unique key and
reportId was the column with duplicates.:


<cfquery name="get" datasource="tableOne">
select distinct reportId, Id from
testReports where date = {ts '2004-02-11 00:00:00'}
order by reportId
</cfquery>


<cfset lastval = 0>
<cfloop query="get">
<cfif lastval IS reportID>
  <cfquery datasource="tableOne">
   delete from testReports where Id = #get.Id#
  </cfquery>
</cfif>
<cfset lastval = reportID>
</cfloop>


-----Original Message-----
From: Paul Vernon [mailto:[EMAIL PROTECTED]
Sent: Monday, February 23, 2004 5:07 PM
To: CF-Talk
Subject: RE: (SOLVED) sql question

Tony,

I have a couple of questions about your solution...

1. As I read your code, I get the impression that ALL of your records had a
single duplicate record. Is that the case?

2. Did you add in the ID field as an extra field to help solve this problem
or was it already there and if it was there all along, is it an auto
incrementing numeric field or guaranteed to be unique in some other way?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to