DELETE `member`
FROM `member`
WHERE `member`.`type_id` = 1;
DELETE `subscriptions`
FROM `subscriptions`
WHERE `subscriptions`.`type_id` = 1;
Table: subscriptions Columns: id int(11) PK AI type_id int(11)
Table: member Columns: id int(11) PK AI type_id int(11)
With the above I seem to be getting the following:
Mysql2::Error: 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 `subscriptions`
FROM `subscriptions`
WHERE `subscriptions' at line 5:
I think the problem that I am having is that I am trying to run both queries at the same time. I have also put this through a syntax checker and it gives the following: screenshot.
On a side note notice that both tables contain the attribute type_id
. I did try to condense this by using an inner join:
DELETE FROM member, subscriptions
USING member
INNER JOIN subscriptions ON type.id = type_id
WHERE type.id= 1;
But I believe the above inner join isn't correct