Mysql中IP地址排序

//假设ip是以字符串形式存储在表my_iptable 的ip字段中,则以下这句可以返回以ip排序的结果
select * from my_iptable order by inet_aton(ip)
//select ip from tlist order by inet_aton(ip)
结果:
10.1.12.1
10.1.12.8
10.1.12.250


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章