How can I ORDER BY integer data in a MySQL column with the "longtext" data type?
In WordPress, the _postmeta table has a column "meta_value" with the "longtext" data type. However, I'm storing integer data i开发者_如何学JAVAn the column and I want to ORDER BY the column by the integers' value.
For example, if I use "ORDER BY meta_value", the result turns out to be something like this:
999
9456
5
123456
111
ORDER BY CAST (meta_value AS DECIMAL)
精彩评论