sort activities query