eQL to order documents so that A100, A101, A102 revisions are below A99

Hi Bentley and eB Forum,

Please could you assist with some eQL? I have a search which brings back all document revisions. When they are less than 100 revisions (i.e. A01 to A99), it is OK. When there are over 100 revisions, it puts A100, A101 and A102 (for example) in between A1 and A2.

We would like it at the bottom of the search results under A99. Please could you help? I have tried using the RIGHT function to get the Revision after the A (first letter) and converted it to Integer type with CAST but it's still not sorting it properly.

Many thanks, best wishes,

Julie