What database are you using? I'll assume MySQL, but this will work on most as well.
Just do something like this:
insert into table.B SELECT * from table.A where id=$id;
And then:
delete from table.A where id=$id limit 1;
That should accomplish what you are trying to do.
-- Jason