Hello,
I have three tables in my database: ingredients , categories, and an intermediary table: ingredients_categories. Let's say I inserted id_ingredient 100 to 150 into ingredients. Right now, if I want to populate the intermediary table I use two queries:
INSERT INTO ingredients_categories (id_ingredient)
SELECT id_ingredient FROM ingredients WHERE id_ingredient BETWEEN 100 AND 150;
UPDATE ingredients_categories SET id_categorie=11 WHERE id_ingredient BETWEEN 100 AND 150;
Is there a smarter way of doing this, with just one query?
With thanks for your help,