On MS access, how to get the "ID" of the records having duplicate content on the "myData" column ?
something like :
---------------------- ------------------------
ID | myData | | ID | myData |
---------------------- ------------------------
1 | AAA | | 1 | AAA |
---------------------- ------------------------
2 | BBB | | 5 | AAA |
---------------------- ==> ------------------------
3 | CCC | | 2 | BBB |
---------------------- ------------------------
4 | BBB | | 4 | BBB |
---------------------- ------------------------
5 | AAA |
----------------------
All I can do so far do is this query:
SELECT myData, COUNT(myData) AS Expr1
FROM fooDB
GROUP BY myData
HAVING (COUNT(myData) > 1)
which only returns a list of the duplicates records from "mydata" and the number of occurrences, adding anything else will fail at execute. (and no ID's)
OR
Saying I accessing the DB as a DataTable in C#, how to manage this? Especially when this table has ~2000 records.
( maybe some help on how to work with INTERSECT to let it return the full rows having duplicates on one column )
Thanks.