What tecnique do you use to remove duplicates?
Let's say I have data set made up of the following columns:
id subid userid
1 27 3872
2 32 3872
3 51 3872
4 16 4218
5 19 5211
The subid is an id for the magazine subscription for that user.
But now let's say that duplicates have somehow gotten into the data...
id subid userid
1 27 3872
2 27 3872
3 32 3872
4 32 3872
5 51 3872
6 16 4218
7 16 4218
8 19 5211
9 19 5211
10 19 5211
What kind of SQL query would select just the extras (not the originals) so I can remove the dups using a DELETE command?
I can identify the userid's and subid's that have dupes but using that query data set to remove would remove everything.
Also note that there may be more than 1 duplicate as in the case of userid=5211 subid=19.
Let's say I have data set made up of the following columns:
id subid userid
1 27 3872
2 32 3872
3 51 3872
4 16 4218
5 19 5211
The subid is an id for the magazine subscription for that user.
But now let's say that duplicates have somehow gotten into the data...
id subid userid
1 27 3872
2 27 3872
3 32 3872
4 32 3872
5 51 3872
6 16 4218
7 16 4218
8 19 5211
9 19 5211
10 19 5211
What kind of SQL query would select just the extras (not the originals) so I can remove the dups using a DELETE command?
I can identify the userid's and subid's that have dupes but using that query data set to remove would remove everything.
Also note that there may be more than 1 duplicate as in the case of userid=5211 subid=19.