Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove products that have the word sex in the title


alexiscruz007

Recommended Posts

I am trying to remove all the products that have the word sex from the catalog, these are some queries.

UPDATE  `products` SET  `products_status` =  '0'
LEFT JOIN `products_description` pd ON p.products_id = pd.products_id
WHERE `products_name` LIKE '%sex%'

or

UPDATE  `products` SET  `products_status` =  '0'
INNER JOIN `products_description` ON (`products`.`products_id` = `products_description`.`products_id`)
WHERE 'products_name` LIKE '%sex%'

This logically would not work but reflects the idea of what I am looking for, if it were an ideal world.

UPDATE  `products` SET  `products_status` =  '0' WHERE  `products_description`.`products_name` LIKE '%sex%;

This query works fine.

SELECT `products_price` , `products_name`
FROM `products` p
LEFT JOIN `products_description` pd ON p.products_id = pd.products_id
WHERE `products_name` LIKE '%seeds%'
AND `products_status` =1
ORDER BY `products_name`
LIMIT 5

Thanks in advance

 

 

 

Link to comment
Share on other sites

UPDATE products p INNER JOIN products_description pd on p.products_id = pd.products_id
  SET p.products_status = 0
  WHERE pd.products_name LIKE '%sex%'

Joins before set.  You can see this in the documentation:  

UPDATE [LOW_PRIORITY] [IGNORE] table_references
    SET assignment_list
    [WHERE where_condition]

Joins are hidden inside what it is calling table_references

Always back up before making changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...