Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6QLVdf30341 for ; Thu, 26 Jul 2001 17:31:39 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f6QLCg816299 for pgsql-sql@postgresql.org; Thu, 26 Jul 2001 17:12:42 -0400 (EDT) (envelope-from news) From: "Jeff Barrett" X-Newsgroups: comp.databases.postgresql.sql Subject: Restriction by grouping problem. Date: Thu, 26 Jul 2001 17:09:24 -0400 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 19 Message-ID: <9jq14a$ft8$1@news.tht.net> X-Complaints-To: scrappy@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 To: pgsql-sql@postgresql.org X-Archive-Number: 200107/350 X-Sequence-Number: 4164 The query I have now: SELECT min(datettime), sid FROM logs GROUP by sid; This returns the first instance of an sid in the logs table, there can be many rows in the table for each sid. The problem I have is that I do not need the SID I just need to group the min(datetime) by it. I need to return the column getfile. So the question I have is how would I create the retstriction of the min(datetime), sid and only return the value of getfile? The english of what I am looking for is. Select the getfile for the earliest of each sid. Any help would be greatly appreciated. --Jeff