Changes message sort clauses for MySQL, fixes issue #961.
Merge pull request #969 from raptium/master

Changes message sort clauses for MySQL, fixes issue #961.