Subject | Re: [firebird-support] between operator on a varchar field |
---|---|
Author | Svein Erling Tysvær |
Post date | 2017-03-31T09:07:10Z |
CHAR, VARCHAR etc. are sorted alphabetically, and (at least in most countries, don't know about languages written from right to left) that means that you first compare the first character, if that is equal the second, then the third and so on until there is a difference. E.g. 'three' < 'two' since 'h' < 'w'. C BETWEEN A AND B is just a different way of writing C >= A AND C <= B.
So, if you want 2015 to sort before 2017, then you have to have the year before the characters, e.g.
’2017/AHH00091’ and ’2017/AHH00141’
HTH,
Set