With WordPress, merging blogs is easy but things get a little more interesting if you only want to merge a selection of categories from the old blog with the new. Here’s a way to do it.
First of all, you need to create a temporary user in WordPress to which the posts can be assigned. You can use whatever name you like, but the name I used was xfer.
Then we need to start hacking the database with whatever your preferred SQL client happens to be. The table prefix in the scripts below is wp_ yours may be different.
-- Script 1
-- Identify the ID for the xfer user
-- Make a note of this, you'll need it later.
SELECT *
FROM wp_users
WHERE user_login = 'xfer';
-- Script 2
-- Identify your categories to be assigned.
-- For each of the categories you want to assign, make a note of the term_id
select * from wp_terms;
-- Script 3
-- Sanity check. This script will list the posts that you are about to reassign
-- You don't need to run it...
-- but I like to know what I'm about to change before I make the change
-- The (60, 42, 44, 36, 63) is the list of term_ids for the categories to reassign,
-- from Script 2
select *
from wp_terms a
join wp_term_taxonomy b on a.term_id=b.term_id
join wp_term_relationships c on b.term_taxonomy_id=c.term_taxonomy_id
join wp_posts d on c.object_id=d.ID
where a.term_id in (60, 42, 44, 36, 63)
and post_status='publish';
-- Script 4
-- Change the author for the posts in the selected categories
-- The 86 is the ID for the xfer user.
-- Use whatever value you retrieved from Script 1
-- The (60, 42, 44, 36, 63) is the list of term_ids for the categories to reassign,
-- from Script 2
update wp_posts
set post_author=86
where ID in
(select c.object_id
from wp_terms a
join wp_term_taxonomy b on a.term_id=b.term_id
join wp_term_relationships c on b.term_taxonomy_id=c.term_taxonomy_id
where a.term_id in (60, 42, 44, 36, 63))
and post_status='publish';
Once this is done, you can go back into WordPress and export just the posts assigned to user xfer.