Would it be possible (with a query) to assign all orphaned threads (threads without an active forum) to be moved to a forum for sorting?

Basically I need any post that belongs to a forum that is no longer active to be moved to forumid = 20 or something of that sort. I've been up all night chasing this so I'm hoping that I can get a handle from someone here as my brain shut off some time around 7am this morning (11 now :P)

Thanks