Count 3 tables and check in one of them for existing ID – Oscommerce
1st query; both tables contain all categories_ids SELECT * FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id ORDER BY sort_order, cd.categories_name 2nd query; this table maybe hold a categories_id SELECT count(*) AS total FROM products_to_categories WHERE categories_id = "'+…