Received: from acheron.rime.com.au (albatr.lnk.telstra.net [139.130.54.222]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6R7prf69416 for ; Fri, 27 Jul 2001 03:51:54 -0400 (EDT) (envelope-from pjw@rhyme.com.au) Received: from oberon (Oberon.rime.com.au [203.8.195.100]) by acheron.rime.com.au (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) with SMTP id f6R7okr20834; Fri, 27 Jul 2001 17:50:47 +1000 Message-Id: <3.0.5.32.20010727175049.030efa30@mail.rhyme.com.au> X-Sender: pjw@mail.rhyme.com.au X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Date: Fri, 27 Jul 2001 17:50:49 +1000 To: "Jeff Barrett" , pgsql-sql@postgresql.org From: Philip Warner Subject: Re: Re: Restriction by grouping problem. In-Reply-To: <3.0.5.32.20010727114713.02793960@mail.rhyme.com.au> References: <9jq4a9$gfr$1@news.tht.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200107/355 X-Sequence-Number: 4169 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 |/