Skip site navigation (1) Skip section navigation (2)

please need help: alpha numeric sorting

From: "Raouf" <aimeur(at)prodigy(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: please need help: alpha numeric sorting
Date: 2002-08-02 08:48:52
Message-ID: 000f01c23a01$6f17bc40$0201a8c0@pavilion (view raw or flat)
Thread:
Lists: pgsql-novice
Hi Gurus,

I need your help for this one:

let's say I have 1 field of type VARCHAR that contains numbers (as ascii) and characters like this:


title 
-----------
12.1 cisco ccnp routing
12.2 cisco ccnp remote access
12.11cisco ccnp switching
12.3 cisco ccnp support 


I'd like to sort that column in alphanumeric order, like this:

title 
-----------
12.1 cisco ccnp routing
12.2 cisco ccnp remote access
12.3 cisco ccnp support 
12.11cisco ccnp switching


but if I sort using group by title and order by title asc I have:

 
title 
-----------
12.1 cisco ccnp routing
12.11cisco ccnp switching
12.2 cisco ccnp remote access
12.3 cisco ccnp support 
12.11cisco ccnp switching

where "12.11cisco ccnp switching" is before "12.2 cisco ccnp remote access" because it is smaller. 

Is it possible  ?

thanks for your help

Responses

pgsql-novice by date

Next:From: Markus WollnyDate: 2002-08-02 08:56:10
Subject: Re: please need help: alpha numeric sorting
Previous:From: Andrew SherDate: 2002-08-01 16:24:20
Subject: passing parameters to views (or alternative methods)?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group