NTrade
Computer
- Jan 10, 2007
- 7
I enjoy sql - but sometimes can't get my head around the puzzle; Have Table1 due to sloppy data entry have duplicates in the Table1:
OrderID Name Address Email
1 Joe xxxx 123@test.com
2 Joe S. x xxx 123@test.com
3 Fred yyy 456@this.com
4 Jim zzz ttt@you.com
5 Joey S x-xxx 123@test.com
6 Jimbo zzz ttt@you.com
The email field is being used as the basis of determining a duplicate and there is about 25 dups per 1000 records or so...(frequently more than 2 dups often up to 4 of the same).
It is presumed the higher OrderID value is the record to be carried forward. Thus I need to return:
OrderID Name Address Email
3 Fred yyy 456@this.com
5 Joey S x-xxx 123@test.com
6 Jimbo zzz ttt@you.com
have been scratching around some sql statements for awhile and would very much welcome input from someone a bit more versant than I...thanks in advance....
OrderID Name Address Email
1 Joe xxxx 123@test.com
2 Joe S. x xxx 123@test.com
3 Fred yyy 456@this.com
4 Jim zzz ttt@you.com
5 Joey S x-xxx 123@test.com
6 Jimbo zzz ttt@you.com
The email field is being used as the basis of determining a duplicate and there is about 25 dups per 1000 records or so...(frequently more than 2 dups often up to 4 of the same).
It is presumed the higher OrderID value is the record to be carried forward. Thus I need to return:
OrderID Name Address Email
3 Fred yyy 456@this.com
5 Joey S x-xxx 123@test.com
6 Jimbo zzz ttt@you.com
have been scratching around some sql statements for awhile and would very much welcome input from someone a bit more versant than I...thanks in advance....