I have the following query:
DELETE proxies, pxpl FROM proxies
JOIN proxy_xref_proxy_list AS pxpl ON proxies.ID=pxpl.ProxyID
WHERE pxpl.DeactivationTS < (NOW() - INTERVAL 24 HOUR)
ORDER BY pxpl.ProxyListID, proxies.ID
The ordering is needed to avoid DB deadlocks. However, it yields an error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY pxpl.ProxyListID, proxies.ID' at line 4
proxy_xref_proxy_list
is a many-to-many relation association table.
ON proxies.ID=pxpl.ProxyID
) on a foreign key? Show us the definitions of the tables, please.pxpl.ProxyID
is a foreign key intoproxies
table (columnID
). Also,pxpl.ProxyListID
is a foreign key.