// sort by day descending - in case there is a bunch of messages on a day that keep timing out, we will eventually get to the next day and hopefully find messages there\r
}\r
sql+="AND tblIdentity.Name <> '' ";\r
// sort by day descending - in case there is a bunch of messages on a day that keep timing out, we will eventually get to the next day and hopefully find messages there\r
- sql+="ORDER BY tblMessageRequests.Day DESC ";\r
+ // secondary ascending sort on tries\r
+ // tertiary sort on request index (so we get low indexes first)\r
+ sql+="ORDER BY tblMessageRequests.Day DESC, tblMessageRequests.Tries ASC, tblMessageRequests.RequestIndex ASC ";\r