Fix the table extraction for nested select statement.