DELETE IF EXIST `#__menu`.*
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';
What is wrong in my sql? I think the problem is in IF EXIST
, but i could not figure out how to use it on row.
Follow the following steps: 1 Step 1: Select your Yes/No column 2 Step 2: Press Ctrl + F value 3 Step 3: Search for No value 4 Step 4: Click on Find All 5 Step 5: Select all by pressing Ctrl + A 6 Step 6: Right-click on any No value and press Delete 7 Step 7: A dialogue box will open 8 Step 8: Select Entire Row 9 Step 9: Click OK More ...
Remove rows if contains value from the remove list with Kutools for Excel. If you have Kutools for Excel – a handy multi-functional tool, you can quickly find the rows which contain values from the other list by Select Same & Different Cells feature and then remove them by yourself.
Delete entire row based on condition with Excel VBA: Step 1: Go to Visual Basic page Step 2: Press Alt + F11 Step 3: Click Insert > Module > New Module Step 4: Paste the code in the new module Step 5: Press F5 to run the code Step 6: The input box will appear to input the value you need to delete ...
If you do not have a flag or value that you can check to see if it is to be deleted, you could use an Exists transformation to look for rows that are not present in the source compared to rows in your target and set those rows for delete. Comment Comment · Show 3 Comment 5 |1600characters neededcharacters leftcharacters exceeded
When you're deleting rows from a table, you don't need to use IF EXISTS
- you're using a WHERE
clause, so if it exists - it will be deleted.
Try changing your query to:
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';
Also, you don't need to specify ```#__menu.*`` (the columns) to be deleted - you'll just need
DELETE FROM...`. Check out here for more info regarding the syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With