I have the following data in SQL:
name ID
A[0] 1
A[1] 1
A[2] 1
AA[0] 2
AA[15] 2
AA[27] 2
I'd like to sort this data, first by ID and then by name. Sorting by ID is easy since it's an int, the problem is with the name - I get weird values, e.g. a[7],a[27],a[3] when I'm trying to sort numerically. When sorting alphbetically I get what you'd expect, a[10],a[11]...a[19],a[2] etc
I assume this is because the field is a varchar and has both numerical and textual parts. Is there any way to sort this? splitting it into substrings seems like a bad option since the length of each part (the textual and numerical) isn't constant.
Thanks!