From: | "Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk> |
---|---|
To: | <tim(at)celestialdesign(dot)co(dot)uk>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Re: GROUPING and ORDERING and CONFUSION |
Date: | 2000-04-20 09:21:12 |
Message-ID: | 00bc01bfaaa9$c564b650$760e01a3@oucs.ox.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
If it was literally the way the data went in, you should be able to order by
oid. Alternatively,
SELECT * FROM tablename ORDER BY substring (text(num) from 1 for 2);
should do it.
----------------------------------------------------------------
Moray(dot)McConnachie(at)computing-services(dot)oxford(dot)ac(dot)uk
----- Original Message -----
From: "Tim Johnson" <tim(at)celestialdesign(dot)co(dot)uk>
To: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, April 20, 2000 2:28 AM
Subject: [SQL] Re: GROUPING and ORDERING and CONFUSION
> Hello,
>
> I was hoping somebody might be able to help me do this: I have a table
with
> two fields (num int, name text)
>
> num | name
> ----------------------------------------------
> 15 | First Category Heading
> 1510 | first category subheading
> 1511 | second category subheading
> 1560 | spurious category subheading
> 156010| first spurious category subheading
> 156011| second spurious category subheading
> 16 | Second Category Heading
> 1610 | Second category subheading
> 161010| Second category subheading subheading
>
> and so on...
>
> My problem is I want to pull that data out and group it so that it comes
out
> just the way it went in.. So my page can read:
>
> 15: First Category Heading
> 1510: first category subheading
> 1511: second category subheading
> 16: ... and so on..
>
>
>
> I thought I could probably group by num on the first two digits and order
by
> asc? but I can't find a way to make that work.
>
> Thanks in advance.
>
>
> Tim Johnson
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael A. Chase | 2000-04-20 10:29:48 | Re: How to do this in pgsql? |
Previous Message | Jan Wieck | 2000-04-20 08:53:47 | Re: TOAST (was: BLOB) |