I like to delete duplicate links from mysql database
From phpmyadmin this command is ok for smal database but get error about some time i have 5gb data in the table
DELETE t2 FROM Link t1 JOIN Link t2 ON (t2.page = t1.page AND t2.linkID > t1.linkID);
I like to delete duplicate links from putty ssh but get error:
[root@server]# mysql -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \\g. Your MySQL connection id is 11433 Server version: 5.5.28 MySQL Community Server (GPL) by Remi
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.
mysql> select database
-> DELETE t2 FROM Link t1 JOIN Link t2 ON (t2.page = t1.page AND t2.linkID > t1.linkID);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELETE t2 FROM Link t1 JOIN Link t2 ON (t2.page = t1.page AND t2.linkID > t1' at line 2
mysql>
how to?
It is best to delete using a simpler query like this
DELETE FROM T2 WHERE LINK IN
(SELECT T2.LINK FROM T1 JOIN T2 ON (T2.PAGE=T1.PAGE AND T2.LINKID > T1.LINKID))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.