美文网首页
Mysql按数字大小排序String字段

Mysql按数字大小排序String字段

作者: IBM_LELE | 来源:发表于2018-09-19 15:30 被阅读0次

xaddress表中 address是string 类型,要实现 address 的数字排序。

SELECT * from xaddress where CoinType='ST' ORDER BY address desc;

可行方案

SELECT * from xaddress where CoinType='ST' ORDER BY -address asc;

_________

SQL 方式

select Address from coldaddress where CoinType='STM' order by cast(Address as int) asc

相关文章

网友评论

      本文标题:Mysql按数字大小排序String字段

      本文链接:https://www.haomeiwen.com/subject/jhwbnftx.html