I am creating an application to store IP Address information in it. However, sorting the IP Addresses has brought up a challenge.
I have 5 columns with Status, IP, Node Name, Comments, and Date. Sorting the columns is a piece of cake, but when I sort the IP column by IPs do something like this:
12.34.56.1
12.34.56.100
12.34.56.101
12.34.56.2
12.34.57.1
12.34.57.100
12.34.57.101
12.34.57.3
....
What I want is this:
12.34.56.1
12.34.56.2
12.34.56.100
12.34.56.101
12.34.57.1
12.34.57.3
12.34.57.100
12.34.57.101
....
Any ideas?
***EDIT
I didn't want this to get lost in the comments, so here is the solution (for MySQL)
I converted from the Internet host address into binary data using function called "INET_ATON".
Example:
SELECT INET_ATON(ipAddress)AS binary_ip, ipAddress
FROM ip_addresses
ORDER BY binary_ip;