>>I am trying to list all of the duplicates of a data pair. I am trying:
>>
>>SELECT TOP 100 PERCENT COUNT(dbo.License.SerialNumber + dbo.License.LicenseKey) AS countKey,
>> dbo.License.SerialNumber + ' ' + dbo.License.LicenseKey AS pair
>>FROM dbo.License INNER JOIN
>> dbo.License License_1 ON dbo.License.SerialNumber + dbo.License.LicenseKey = License_1.SerialNumber + License_1.LicenseKey
>>GROUP BY dbo.License.SerialNumber + ' ' + dbo.License.LicenseKey
>>HAVING (COUNT(dbo.License.SerialNumber + dbo.License.LicenseKey) > 1)
>>ORDER BY countKey
>>
>>But the countKey item returns the same number for every item. I have verified this is incorrect. What am I doing wrong, or rather, what would be the best way to accomplish this?
>
>
>SELECT dbo.License.SerialNumber, dbo.License.LicenseKey, COUNT(*) AS Cnt
>FROM dbo.License
>HAVING COUNT(*) > 1
>GROUP BY 1,2
>ORDER BY 1,2
>
>(not tested)
thank you. It worked with only a little manipulation:
SELECT SerialNumber, LicenseKey, COUNT(*) AS Cnt
FROM dbo.License
GROUP BY SerialNumber, LicenseKey
HAVING (COUNT(*) = 1)
Thank You
Rollin Burr
Politicians and diapers have one thing in common. They should both be changed regularly, and for the same reason.