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


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