Возможно, немного более надежный, чем вы искали, но очень многократно используемый, вот функция, которую вы можете вызвать и, необязательно, передать родительскому контейнеру для выбора таблиц внутри, а также возможность удалить их со страницы после их обработки, но этовернет вам все ваши таблицы в объединенной структуре, как вы указали.
function mergeTables(parent, remove){
//if no parent is passed, default to body
if (!parent){
parent = 'body';
}
//place to store the full HTML string of all the combined tables
var table_html = '<table><tr>';
//go through all tables
$(parent).find('table').each(function(){
//add their HTML to our big HTML string
table_html += '<td><table>' + $(this).html() + '</table></td>';
//remove that table from the page
if (remove){
$(this).remove();
}
});
//close off and return the big HTML string
return table_html + '</tr></table>';
}
//call example
$('#container').html( mergeTables('#container') );