I connect to my SpiceWorks database via PHP using the SQLITE3 PDO. I am trying to display a list of devices in order by IP address. Here is my current query:
SELECT name, ip_address FROM `devices` ORDER BY ip_address
The problem with this is that it organizes them weird like this:
Is there any easy way to fix this problem?
It is not possible for me to edit the database because it would through SpiceWorks off. I need a way to do this in SQL.
Have you tried INET_ATON function? This is probably a late answer, but maybe it'll help others.
SELECT name, ip_address
FROM devices
ORDER BY
INET_ATON(ip_address)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With