Jump to content

Bulk delete empty categories from DB


bibob
 Share

Recommended Posts

Found a solution

 

DELETE FROM`ps_category`  WHERE   `id_category` != 1   and  id_category not in    (SELECT cp.id_category from  ps_category_product cp ) ;
DELETE FROM `ps_category_lang` where id_category not in (select id_category from ps_category);
DELETE FROM `ps_category_group` where id_category not in (select id_category from ps_category);
DELETE FROM `ps_category_shop` where id_category not in (select id_category from ps_category);
  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

  • 5 months later...

This is excellent

 

Was successful

 

Thankful   :) 

 

 

Found a solution

 

DELETE FROM`ps_category`  WHERE   `id_category` != 1   and  id_category not in    (SELECT cp.id_category from  ps_category_product cp ) ;
DELETE FROM `ps_category_lang` where id_category not in (select id_category from ps_category);
DELETE FROM `ps_category_group` where id_category not in (select id_category from ps_category);
DELETE FROM `ps_category_shop` where id_category not in (select id_category from ps_category);

 

Share this post


Link to post
Share on other sites

  • 1 year later...

Удаление пустых категорий. Что были созданы при тестировании загрузчика, работает, спасибо.

да можно было в ручную, но долго !

Share this post


Link to post
Share on other sites

  • 1 year later...
  • 1 year later...
On 4/21/2020 at 12:11 AM, Gipielle said:

Hello, this query is for all prestashop versions ?

I ps 1.7 replace ps_ by miib_

 

DELETE FROM`miib_category`  WHERE   `id_category` != 1   and  id_category not in    (SELECT cp.id_category from  miib_category_product cp ) ;
DELETE FROM `miib_category_lang` where id_category not in (select id_category from miib_category);
DELETE FROM `miib_category_group` where id_category not in (select id_category from miib_category);
DELETE FROM `miib_category_shop` where id_category not in (select id_category from miib_category);

 

Edited by jmauclair (see edit history)
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More