query sort by created and updated date