I’m trying to insert a relationship in table ‘products_to_categories’ when the condition is met in the ‘products’ table (master_categories_id = 500) My guess is because my SELECT statement should be a JOIN?
table: products_to_categories
columns: products_id, categories_id
table: products
columns: products_id, master_categories_id
INSERT INTO products_to_categories (products_id, categories_id)
SELECT products.products_id, 500 FROM products
WHERE products.master_categories_id=500 HAVING count(categories_id) < 1;
error returned: categories_id is an invalid column
few ways:
Or