Sorting high to low issue help

Sort numeric values incorrectly in a database column.

Overview

The column is stored as text, causing alphanumeric sorting where '53' appears after '520'.
Change the column's data type from text to integer to enable proper numeric sorting.

cr cruser 15 Oct, 2020
In the screenshot below you can see that there columns "Item 1" and "Item 2" have values. Item 2 column does not sort in the proper order as the value 53 is less than 520. How do I get this so that single, double, and triple-digit values sort properly? Item 1 column sorts highest to lowest while Item 2 sorts the results of Item 1 from highest to lowest.

Sorting high to low issue help image 1

Sorting high to low issue help image 2
cr cruser 23 Oct, 2020
1 Likes
Hey thanks, Max! I changed the structure type in those columns from varchar(255) to int(255) and it all lined up perfectly.
This topic is locked and no more replies can be posted.