Mysql – Delete with join and condition (3 tables) – MySQL

deleteMySQL

Need some assistance on MySQL delete using join with condition (3 tables).

snote (child table)
--------
snote_id
bnote_id

bnote (parent table of snote)
------
bnote_id
note_id

note (parent table of bnote)
----
note_id

Want to delete all snote records with bnote_id=10 and note_id=5

Best Answer

Able to find the answer in another post... Sorry for raising this as duplicate

DELETE `stn` FROM `snote` AS `stn` 
LEFT JOIN `bnote` AS `ban` ON `ban`.`bnote_id`=`stn`.`bnote_id` 
WHERE `ban`.`note_id`='5' AND `stn`.`bnote_id` = '10'