如何从MAXMIND数据库中删除重复项?

时间:2014-01-21 09:45:13

标签: sql duplicates maxmind

我目前正在使用GeoIPCity-Location表处理Maxmind数据库,并意识到数十万个数据是重复的。例如,我搜索过泰恩河畔纽卡斯尔:

SELECT * FROM MAXMIND
WHERE city='Newcastle Upon Tyne';

结果是:

369137  GB  I7  Newcastle Upon Tyne NE20    54.9881 -1.6194
369332  GB  I7  Newcastle Upon Tyne NE6 54.9881 -1.6194
369345  GB  I7  Newcastle Upon Tyne NE13    54.9881 -1.6194
369355  GB  I7  Newcastle Upon Tyne NE3 54.9881 -1.6194
369356  GB  I7  Newcastle Upon Tyne NE5 54.9881 -1.6194
369645  GB  I7  Newcastle Upon Tyne NE4 54.9881 -1.6194
369706  GB  I7  Newcastle Upon Tyne NE15    54.9881 -1.6194
369959  GB  I7  Newcastle Upon Tyne NE12    54.9881 -1.6194
370114  GB  I7  Newcastle Upon Tyne NE27    54.9881 -1.6194

如果我只是搜索“纽卡斯尔”,那就更糟了:

382 ZA  2   Newcastle       -27.758 29.9318
2279    US  OK  Newcastle   73065   35.2323 -97.6008
26459   US  CA  Newcastle   95658   38.873  -121.1543
22382   CA  ON  Newcastle   l1b1j9  43.9167 -78.5833
38995   AU  2   Newcastle       -32.9278    151.7845
40025   US  ME  Newcastle   4553    44.0438 -69.5675
47937   GB  I7  Newcastle       54.9881 -1.6194
119830  US  ME  Newcastle   4553    44.0438 -69.5675
119982  US  NE  Newcastle   68757   42.6475 -96.9232
115052  US  CA  Newcastle   95658   38.873  -121.1543
120603  US  NE  Newcastle   68757   42.6475 -96.9232
127931  US  OK  Newcastle   73065   35.2323 -97.6008
136726  CA  ON  Newcastle       43.9167 -78.5833
136915  US  TX  Newcastle   76372   33.245  -98.9103
137128  US  WY  Newcastle   82701   43.8396 -104.5681
137130  US  WY  Newcastle   82701   43.8396 -104.5681
144799  IE  16  Newcastle       52.4492 -9.0611
207626  US  UT  Newcastle   84756   37.6924 -113.6272
213128  US  UT  Newcastle   84756   37.6924 -113.6272
221968  KN  5   Newcastle       17.2    -62.5833
229237  CA  ON  Newcastle   l1b1l4  43.9167 -78.5833
232235  GB  M9  Newcastle       54.9881 -1.6194
229005  CA  ON  Newcastle   l1b1g1  43.9167 -78.5833
228722  CA  ON  Newcastle   l1b1k9  43.9167 -78.5833
242102  CA  NB  Newcastle       46.9833 -65.5667
252530  IE  7   Newcastle       53.3011 -6.5022
267662  CA  ON  Newcastle   l1b1h5  43.9167 -78.5833
266263  IE  31  Newcastle       53.0683 -6.0658
313271  CA  ON  Newcastle   l1b1h8  43.9167 -78.5833
306632  IE  10  Newcastle       53.3408 -8.6783
320151  CA  ON  Newcastle   l1b1l2  43.9167 -78.5833
336868  GB  L6  Newcastle       52.4333 -3.1167
353050  GB  R9  Newcastle       54.2    -5.8833
349314  GB  Q7  Newcastle       54.3833 -5.4667
377107  ZA  2   Newcastle   2940    -27.758 29.9318
369587  GB  I7  Newcastle   ST5 54.9881 -1.6194
387865  AU  2   Newcastle   2297    -32.9278    151.7845
387889  AU  2   Newcastle   2300    -32.9278    151.7845
387978  AU  2   Newcastle   2306    -32.9278    151.7845
388098  AU  2   Newcastle   2302    -32.9278    151.7845
392595  AU  2   Newcastle   2296    -32.9278    151.7845
388376  AU  2   Newcastle   2899    -32.9278    151.7845

有没有办法删除重复项?我怎么知道要删除哪些副本以及要保留哪些副本?

由于

0 个答案:

没有答案