Finding duplicate values from the table having no primary key

Jigs

Registered User.
Local time
Tomorrow, 04:42
Joined
May 19, 2005
Messages
40
Hi All,

I have one table where ID field is autogenerated, and another field orderno which is not primary key. Now it has 2 duplicate values in it so when I try to make field Orderno as primary key, it is not allowing me to do so.

Can any one help me how to find the duplicate values using query.

Thanks in advance,

Jigs
 
Last edited:
SELECT *
FROM [TableName]
WHERE [OrderNo] In (SELECT [OrderNo] FROM [TableName] GROUP BY [OrderNo] HAVING Count(*)>1 )
ORDER BY [OrderNo];


Alternatively, you can use the Find Duplicates Query Wizard to build a similar query.
.
 

Users who are viewing this thread

Back
Top Bottom