added code to handle 'select *' from multiple tables.