0

For this salesforce document, it said SOQL OrderBy sorting case insensitive.

I would ask if possible to make SOQL OrderBy sorting case sensitive?

Please take a look follow picture. I try orderby Id in a query and the sort result by Id look not case insensitive for me, does anyone know why?

enter image description here

Best wishes, Lee

1
1

Id values are actually really big numbers represented as base-62 encoded strings, not actual String values in the normal sense, like Name or Phone. As such, when you ORDER BY Id, you get output that roughly represents the order in which those records were created. The final three characters are parity bits, and so don't factor in to the order in which Id values are listed. The Id values are in the correct order, just not necessarily the order you'd expect.

1
  • Thank you for your help. – GhostLee May 11 '20 at 7:15
0

Not really no. Order By Id will order them alphabetically. After all Id is a special type of String.

0

The ids given in the picture are already in ascending order.

The order depends solely on the basis of ASCII value of the alphabets (i.e they are case sensitive).

In ASCII Table :

A-Z goes from 65-90

a-z goes from 97-122

Thanks,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.