In our EE1 installation we have the preference "Auto-Assign Category Parents" set to "No".
Now I am faced with a situation where for once particular set of categories it would be very useful to have this as "Yes" but It still probably makes sense for it to be "No" system-wide tho so we are still leaving it off as I don't believe there's any way to have it work just for one set of categories.
My question is this... Is there any way to "automatically" apply the parent category to all the entries that already have this particular subset of categories that I am interested in?
I see an EE2 answer here...
Automatically assign parent category to sub-category entries?
But I am in EE1.
I started to look at this in MySQL...
This query gives me all the entries that I would like have the parent category:
select distinct
(t.entry_id)
from
exp_weblog_titles t
left join
exp_category_posts cp ON t.entry_id = cp.entry_id
left join
exp_categories c ON c.cat_id = cp.cat_id
where
t.weblog_id = 5 and c.parent_id = 4810
order by entry_id
limit 100000
But what if some of them already the parent category assigned? I don't want to categorize them twice. I think I need to use something like:
INSERT INTO exp_category_posts ...
WHERE NOT EXISTS
(SELECT *
from exp_category_posts
where cat_id = 4810 and entry_id = ?this_entry_id?)
but the syntax is a little beyond me.
Since I framed this as primarily a mySQL question I've cross-posted it to SO casting the question a little bit differently.