I need to reassign all uncategorised entries into a certain category, I've managed to create an SQL query which selects all the entries for that channel which aren't assigned to any categories, but I'm getting a bit stuck when it comes to updating the
exp_category_posts table. SQL isn't my strongest area so help would be appreciated.
This is my SQL for selecting the entries:
SELECT exp_channel_data.entry_id FROM exp_channel_data LEFT JOIN exp_category_posts ON exp_channel_data.entry_id = exp_category_posts.entry_id WHERE exp_category_posts.entry_id IS NULL AND channel_id = 5;
exp_category_posts has two columns,
cat_id, I need to pull in the
entry_id from the
exp_channel_data table and hardcode the
cat_id column to a certain value.