Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicates 1

Status
Not open for further replies.

NetworkGuy101

IS-IT--Management
Joined
Aug 13, 2002
Messages
482
Location
US
Is there a way for me to get duplicate record that match certain criteria. Like only if there are duplicates in the subjectid field and criteriaid field? Help is appreciated.

Thanks,
Joe
 
or did you want to compare every record against every record to find duplicates in a givin field?

 
compare every record against every records to find matching duplicates thats what i want. I actually want to find where there are duplicates in 2 fields in every record.
 
Code:
select subjectid
     , criteriaid 
     , count(*) as howmanydupes
  from yourtable
group 
    by subjectid
     , criteriaid 
having count(*) > 1

rudy
SQL Consulting
 
I ran your code Rudy and got the following error:
Attribute validation error for tag CFQUERY.
The tag does not allow the attribute(s) NAMES. The valid attribute(s) are BLOCKFACTOR,CACHEDAFTER,CACHEDWITHIN,CONNECTSTRING,DATASOURCE,DBNAME,DBPOOL,DBSERVER,DBTYPE,DEBUG,MAXROWS,NAME,PASSWORD,PROVIDER,PROVIDERDSN,SQL
Here is my query:
<cfquery names="getdups" datasource="checklists">
select subjectid , criteriaid , count(*)
from Answers18OG
group by subjectid , criteriaid having count(*) > 1
</cfquery>
<cfdump var="#getdups#">
 
Sorry Rudy I had a in my name attribute. Your code worked great thanks! Joe
 
dude, it's <cfquery name="getdups

you have <cfquery names="getdups

:-)



rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top