mysql - Sorting a varchar column as a numeric one using collate -
i have mysql table has varchar column. column contains numbers , want able sort numerically, i.e. 100, 101, 1001. sorts them 100, 1001, 101 etc. heard alter table add collate attribute sorted numerically. when type "show collation" don't see collation type seems meant treating varchar column numeric one.
so question is, collation can use sort varchar column numerically?
if varchar column contains numbers, should integer column. otherwise, can do
order cast(col signed)
Comments
Post a Comment