MySQL field type to count bytes filesize
count, filesize, mysql, php
Solution
VARCHAR will definitely give you the incorrect results as is will sort from left to right.
eg, VARCHAR sorted will place 12 before 2, as the first 1 in 12 is less than 2.
But INT should give you what you require.
Have a look at a couple of types here
Numeric Types
Problem
I'm storing document information (Word, excel, ...) in a MySQL database. I have a column "size" where I store the filesize in bytes like 582656, 136260, 383266... But when I order by size, the results are a little bit disorderly. What type of MySQL field should I use? I've tried VARCHAR and INT, the same result.