views:

134

answers:

1

Hi,

I've another question I wish to sort a list of IP address.

Are there any functions in Postgresql to use with the order by like INET_ATON in MySql ?

My current IP is on string format.

Thx.

Narglix

+2  A: 

You can order your IP address column IP_Address with something like this:

SELECT * FROM MyTable ORDER BY inet(IP_Address)

See the documnetation for further reference.

Edit:

This is actually not a function but a type cast to the postgres integrated type for IP addresses.

Frank Bollack