Mysql does not have the data for this condition? Update the value of data from another table to another table?

question
A number table is post_id
B number table bit is url
An and B have a lot of data
An and B some post_id matches url, and some are inconsistent (the fields related to An and B are post_id and url)
how do I eliminate all those that do not match? Leave only relevant

DELETE a, b FROM   
`a`   
JOIN `b` ON b.ID != a.post_id
....

mariaDB report error:

-sharp1064 - 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 "JOIN b ON b.ID != a.post_id" at line 3

and then say

Is this paragraph

a, b an unexpected symbol?

PS:

  • I want to delete two data tables as long as there are any non-conformities.
  • I"m sure there are a lot of SELECT data that don"t match, and there are also matching data.
  • a has multiple post_id, for example, if b.ID equals 123then a.post_id has one or more 123s
Jul.12,2021

first of all, your delete statement is a syntax error, there is no reason to delete two tables at once.

because you want to delete two tables, delete them one by one as follows:

-sharp a
DELETE FROM a WHERE post_id NOT EXISTS (SELECT ID FROM b);
-sharp b
DELETE FROM b WHERE ID NOT EXISTS (SELECT post_id FROM a);

you should clear table A through A left join B, first. Then use B left join A to clean up table B.

or use inner join to take it out. And then deal with it in the way of not in. Of course, this approach is less efficient.

in addition, be sure to back up your data before performing delete operations to avoid unnecessary losses.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e83a2d-c70.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e83a2d-c70.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?