When you delete rows from a table, you do not need to use IF EXISTS - you use the WHERE , so if it exists, it will be deleted.
Try changing the query:
DELETE FROM `#__menu` LEFT JOIN `#__extensions` ON `#__extensions`.`name` = 'com_view' WHERE `#__menu`.`component_id` = `#__xtensions`.`extension_id` AND `#__menu`.`alias` = 'view-sites' AND `#__menu`.`path` = 'view-sites' AND `#__menu`.`title` = 'View sites';
In addition, you do not need to specify `` #__ menu .*`` (the columns) to be deleted - you'll just need DELETE FROM ... `. Read more about syntax here .
source share