Re: order by question

From: "Duncan Adams (DNS)" <duncan(dot)adams(at)vcontractor(dot)co(dot)za>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: order by question
Date: 2002-02-05 11:15:25
Message-ID: C54EF5B83335D311BCB50000C11042B102C8C887@vodabemail1.vodacom.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

yip that sets me on the correct path.

have been thinking of re-doing the complete database. thing is that in this
case, the guys capturing the data some times type place DE/DF26 for double
cabinets which is why the data model was done that way (i think) no one
thought that reports on rows would be wanted at the time.

thanx again
duncan

-----Original Message-----
From: Allan Engelhardt [mailto:allane(at)cybaea(dot)com(dot)INVALID(dot)Make(dot)me(dot)valid]
Sent: Tuesday, February 05, 2002 12:13 PM
To: Duncan Adams (DNS)
Subject: Re: [NOVICE] order by question

test=# create table t(p text);
CREATE
test=# insert into t values ('AA01');
INSERT 344153 1
test=# insert into t values ('AA02');
INSERT 344154 1
test=# insert into t values ('EF01');
INSERT 344155 1
test=# insert into t values ('AB01');
INSERT 344156 1
test=# select * from t order by substring(p from 3 for 2), p;
p
------
AA01
AB01
EF01
AA02
(4 rows)

You want the 'Functions and Operators' section in the 'User's Guide'. You
may
also want to (re-)consider your data model.

Hope this helps a little.

Allan

Duncan Adams (DNS) wrote:

> hi all
>
> i have a table that holds reference point for a grid
> (computer room floor) the references are laid out as
> following.
>
> Horizontal AA to EF
> vertical(rows) 01 to 32
>
> the references are stored as a single value e.g.
>
> AA01, AA02 to EF32
>
> Now my question, is it possible to do a query and return
> the values ordered by the last two numbers (order by rows)
> and if so how?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2002-02-05 15:39:54 Re: Problem with joins
Previous Message Duncan Adams (DNS) 2002-02-05 09:38:24 order by question