Fix the multi-table-select SQL execution in several ways