Fixed AOR sort by issue in MsSQL