[thelist] MS SQL 2000

Casey Crookston caseyc at IntelliSoftmn.com
Tue Aug 22 10:49:56 CDT 2006


What I was hoping for was to return all rows that had a duplicate (not
including the unique id).  If one row was repeated three times, it would
return all three rows.  

Is this worth examining?  Or is it too complex?

Casey


--- Original Message --
[snip]
> > SELECT COUNT(`foo`) AS `duplicate` FROM `bar` GROUP BY `foo`
> > HAVING `duplicate` > 1 

1. Except if 'foo' IS NULL, where COUNT(*) might be better.
[/snip]

True, it was just a starting point. If the OP wants entire records this
query is going to get quite complex.

[snip]
2. But does the OP want one row for each row that has a duplicate, or
   one row for each set of duplicates?
[/snip]

My impression was that the OP wants one unique row, regardless of the
number of duplicates. 




More information about the thelist mailing list