Qwiki : Order IP Addresses in MySQL

78

mysql> select ip from table order by INET_ATON(ip) desc;

Now the results are as expected:

| 10.5.0.81 |
| 10.5.0.80 |
| 10.5.0.79 |
| 10.5.0.78 |

| 10.5.0.11 |
| 10.5.0.10 |
| 10.5.0.9 |
| 10.5.0.8 |

The INET_ATON function was a life saver.

 

Shawn