Sort query list