Hey everyone I am trying to delete from multiple tables with the following query
mysql> DELETE
-> info, pagelets, shingles, links
-> FROM
-> info
-> INNER JOIN pagelets
-> ON info.page_key=144
-> AND info.page_key=pagelets.page_key
-> INNER JOIN shingles
-> ON pagelets.pagelet_serial=shingles.pagelet_serial
-> INNER JOIN links
-> ON pagelets.pagelet_serial=links.pagelet_serial
-> ;
Query OK, 2050 rows affected (0.08 sec)
mysql> SELECT * FROM info;
+--------+----------+
| netloc | page_key |
+--------+----------+
| 1 | 2 |
| 1 | 118 |
+--------+----------+
2 rows in set (0.00 sec)
mysql> SELECT * FROM pagelets WHERE page_key =144;
+----------+----------------+
| page_key | pagelet_serial |
+----------+----------------+
| 144 | 245 |
| 144 | 246 |
| 144 | 249 |
| 144 | 253 |
Unfortunately, this only works on a the table links and info. ( Don' tknow why it doens't work on pagelets and shingles)
The original query was:
# DELETE
# info, pagelets, shingles, links
# FROM
# info INNER JOIN pagelets INNER JOIN shingles INNER JOIN links
# WHERE
# info.page_key=%(page_key)s
# AND info.page_key=pagelets.page_key
# AND pagelets.pagelet_serial=shingles.pagelet_serial
# AND pagelets.pagelet_serial=links.pagelet_serial
#
any one can explain this mystery?