updated the message order query