Reputation: 1
My current comment reply system:
1
1.1
1.2
1.2.1
10
2
2.1
I can sort the comments from table by their ids (as above) and indent depending on the number of dashes.
The problem is that '10' comes right after '1.2.1'. Is it possible to sort values such as '1.2.1' as a number and not string? Does any number data type excepts multiple dots or commas?
Thanks in advance!
Upvotes: 0
Views: 444
Reputation: 254924
The common way in materialized path trees is to pad ids to a N-digit number with zeros so it comes 00001 etc
00001
00001.00001
00001.00002
00001.00002.00001
00002
00002.00001
00010
Upvotes: 2