Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 09/18/2019 in all areas

  1. 1 point
    mfleeson

    Products without categories

    Just a silly bit of SQL. I realised that products I had used in previous promotion were not displaying as they were not in any categories, so here's a little bit of SQL to help fix databases if you've been using other tools to administrate your products. 1 - Check for products not in categories. SELECT * FROM products WHERE products_id NOT IN (SELECT DISTINCT products_id FROM products_to_categories); 2 - If none display then you're fine. If they do then choose a category to put them in and get the category number. If need be create a new category and look for the number in the database, i.e. SELECT MAX(categories_id) FROM categories_description; 3 - Move the uncategorised products into your new category... If the previous query resulted in 211 then INSERT INTO products_to_categories SELECT products_id,211 FROM products WHERE products_id NOT IN (SELECT DISTINCT products_id FROM products_to_categories);
×