split SELECT generation to selectQuery