setting up order, limit, and offset for union queries