drop table table_a;
CREATE TABLE table_a (
id bigint(10) NOT NULL AUTO_INCREMENT,
number varchar(255)DEFAULT NULL,
PRIMARY KEY (id)
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
insert into table_a(number) VALUES(1),(10),(5),(3),(2),(11),(14),(12),(13);
SELECT * FROM table_a AS a ORDER BY CAST(a.number AS UNSIGNED);
SELECT * FROM table_a AS a ORDER BY CAST(a.number AS decimal(10,0))
其它文章
沒有留言:
張貼留言