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

Order by sub-select

From: "Daniel T(dot) Staal" <DStaal(at)usa(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Order by sub-select
Date: 2008-01-09 17:12:21
Message-ID: 61849.63.172.115.138.1199898741.squirrel@MageHandbook.com (view raw or flat)
Thread:
Lists: pgsql-novice
In the following query:
SELECT name, contact, phone, email FROM eforward.address
        WHERE gsb IN ( SELECT gsb FROM eforward.ibox
                WHERE ibx IN ( SELECT DISTINCT ibx FROM eforward.partner
                        WHERE pibx = 'MTCBIN'));

How would I sort the result by eforward.partner.ibx?  I tried an 'ORDER
BY' clause in the sub-select, but that doesn't appear to work.  (If you
drop the outer query, the order does appear to be maintained however.)

I'm using postgres 8.1.0.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


Responses

pgsql-novice by date

Next:From: Rodrigo E. De León PlicetDate: 2008-01-09 17:39:26
Subject: Re: Order by sub-select
Previous:From: Tom LaneDate: 2008-01-09 15:24:32
Subject: Re: two postgres binaries

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