Another similar approach to Nicks:

SELECT DISTINCT MyTable1.* 
  FROM MyTable Table1, MyTable Table2
 WHERE Table1.MatchColumn1 = Table2.MatchColumn1 
   AND Table1.MatchColumn2 = Table2.MatchColumn2
   AND Table1.ID <> Table2.ID
 ORDER BY Table1.MatchColumn1, Table1.MatchColumn2

S.

> -----Original Message-----
> From: DeVoil, Nick [mailto:[EMAIL PROTECTED]]
> 
> Try something like this:
> 
> select *
> from table
> where colA & colB in
>     (select colA & colB, count(*)
>      from table
>      group by colA & colB
>      having count(*) > 1)
> 
> This is if colA and colB are strings (char/vchar/text).
> If they're numbers or dates you'll need to convert them
> to strings using the appropriate function for the DBMS.
> The concatenation operator will also be DBMS-dependent.
> 
> Nick
> 
> -----Original Message-----
> From: Palyne Gaenir [mailto:[EMAIL PROTECTED]]
> Subject: Listing duplicated records
> 
> 
> I have an app where sometimes sometimes entries get duped, and I want
> to run a utility to display all those records.  I was looking through
> count/sum/distinct functions but I'm not sure what to do here.  I
> want to say, "look through this table.  Look at all the entries in
> these two fields.  If there is more than one record in this table
> with the same values in those two columns as any other record, list
> all those records for me."  I don't even know where to start here,
> since I don't actually have any particular value to WHERE by.  Has
> anybody ever done this?
> 
> Best regards,
> PJ
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to