I have just studied
SELECT * FROM (SELECT * FROM usrs) as u WHERE u.name = 'john'
DELETE FROM (SELECT * FROM usrs) as u WHERE u.name = 'john'
UPDATE (SELECT * FROM usrs) as u SET u.lname ='smith' WHERE u.name = 'john'
delete from first table rows effected? quit: else check second table rows effected? quit : else check third table
Delete from (select * from tb1 union all select * from tb2 union all select * from tb3) e as e.uname = 'john'
You can't directly delete from the subquery, but you can still use it if you'd like, you'll just need to use it in a
DELETE usrs FROM usrs INNER JOIN ( SELECT * FROM usrs WHERE name = 'john' ) t ON usrs.Id = t.Id
Or you could use
DELETE usrs WHERE ID IN ( SELECT ID FROM usrs WHERE name = 'John' )
With this said, for this example, I don't know why you'd want a subquery:
DELETE usrs WHERE name = 'John'
Edit base on comments. To delete from multiple tables at the same time, you can either have multiple
DELETE statements, or you can use something like the following:
delete t1, t2, t3 from (select 'john' as usr) t left join t1 on t.usr=t1.usr left join t2 on t.usr=t2.usr left join t3 on t.usr=t3.usr