I have attempted to innerjoin 2 tables and then delete the selected ids using “IN”. It has given me an error and was wondering what I am doing incorrectly with this.
DELETE
FROM
my_table b
INNER JOIN
my_table_assoc a
ON
b.foo_id= a.foo_id
WHERE
b.foo_id IN ($delete_list) ";
However, when I think about it this way it makes no sense because i am failing to delete the id in my_table_assoc. Do I need to use an outer join to delete the needed row in both tables simultaneously?
DELETE does not delete columns, it deletes rows.
The syntax allows
DELETE b, a FROM ...orDELETE b.*, a.* FROM ....It doesn’t make any sense to list specific columns you want to delete.