The following changes the relationships between worldpress posts and their category, although it can be modified for other uses.
the example changes posts in category ID #10 and places them in category ID #20
UPDATE wp_term_relationships
SET term_taxonomy_id =
(SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id =10)WHERE term_taxonomy_id =
(SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id =20)