Re: Re: Restriction by grouping problem.

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: "Jeff Barrett" <jbarrett(at)familynetwork(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Re: Restriction by grouping problem.
Date: 2001-07-27 07:50:49
Message-ID: 3.0.5.32.20010727175049.030efa30@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 11:47 27/07/01 +1000, Philip Warner wrote:
>
>...the FROM statement would be a lot nicer if your had a table of SIDs, or
>at least had a good way of generating the list of SIDs.
>

A final (& possibly best) option, is:

Select
MDT.GETFILE,
[anything else from 'best' record]
From
(Select Distinct SID From LOGS) as S,
(Select * From LOGS L Where L.SID = S.SID
Order By DATETIME Asc Limit 1) as MDT

But unfortunately PG 7.1 does not allow this - the second select can not
reference the first select. I have not tried it in 7.1.2.

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message guard 2001-07-27 09:48:46 nullif BUG???
Previous Message Tom Lane 2001-07-27 05:20:26 Re: Meta integrity