Re: [GENERAL] order by

From: dave madden <dhm(at)paradigm(dot)webvision(dot)com>
To: milang(at)tal(dot)org
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] order by
Date: 1998-06-11 17:09:23
Message-ID: 199806111709.KAA18133@paradigm.webvision.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=>From: Kaj-Michael Lang <milang(at)tal(dot)org>
=>...
=>I have stored IP's in a table using a varchar(15) field. My problem is how
=>to make the order by list the IP's the correct order like:
=>
=>192.168.1.1
=>192.168.1.6
=>192.168.1.10
=>
=>now it sorts them like:
=>
=>192.168.1.1
=>192.168.1.10
=>192.168.1.6
=>
=>is it possible to get them sorted the right way ?

There may be a special function (or you could write one) to sort
numbers which are represented as varchars, but a better solution would
be to re-store the IP numbers as integers. This will also allow you
to work on them with netmasks and so forth. Convert them back to
A.B.C.D when you print them out.

d.

In response to

  • order by at 1998-06-11 11:46:46 from Kaj-Michael Lang

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Byron Nikolaidis 1998-06-11 17:25:27 Re: [GENERAL] PostgreSQL/ODBC/WinNT?
Previous Message Frederic OLIVIE 1998-06-11 16:53:51 copy does stop when breaking a unique index rule