[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] sql help, reusing a column
From:       Andy Colson <andy () squeakycode ! net>
Date:       2010-04-30 1:59:34
Message-ID: 4BDA3986.9030109 () squeakycode ! net
[Download RAW message or body]

On 04/29/2010 05:08 PM, Thomas Kellerer wrote:
> SELECT organization, state, lastdate, age(lastdate)
> FROM (
>    SELECT organization,
>           state,
>           (select max(idate) from times where
> customers.custid=times.custid and taskid = 27) as lastdate
>    FROM customers
> ) t
> order by lastdate desc

Ah, yes, that does work, very nice.  Thank you.

-Andy

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic