继吉 发表于 2018-9-27 09:19:31

MYSQL中删除重复记录的方法

1、  具体实现如下:
  Table         Create Table
  --------------------------------------------------------------------
  users_groupsCREATE TABLE `users_groups` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uid` int(11) NOT NULL,
  `gid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8
  users_groups.txt内容:
  1,11,502
  2,107,502
  3,100,503
  4,110,501
  5,112,501
  6,104,502
  7,100,502
  8,100,501
  9,102,501
  10,104,502
  11,100,502
  12,100,501
  13,102,501
  14,110,501
  mysql> load data infile 'c:\\users_groups.txt' into table users_groups fields
  terminated by ',' lines terminated by '\n';
  Query OK, 14 rows affected (0.05 sec)
  Records: 14Deleted: 0Skipped: 0Warnings: 0
  mysql> select * from users_groups;

页: [1]
查看完整版本: MYSQL中删除重复记录的方法