I have problem with sorting in SQL.
Data:
ID accountCode
1 A99
2 A3792
3 A230
4 A2
5 AA2
6 AB23
7 EXMPLECODE
Query:
select top 1 accountCode
from AccountCodes
where accountCode like 'A%'
order by accountCode desc
Result:
A99
Expected Result:
A379
How can I get A379 result in this stuation?
Thank you for help