Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 9F8779F9944 for ; Mon, 27 Aug 2007 13:33:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 52049-08 for ; Mon, 27 Aug 2007 13:33:43 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 25DC29F9993 for ; Mon, 27 Aug 2007 13:33:43 -0300 (ADT) Received: (qmail invoked by alias); 27 Aug 2007 16:33:42 -0000 Received: from IP.217.31.76.68.CEGECOM.LU (EHLO [192.168.168.32]) [217.31.76.68] by mail.gmx.net (mp053) with SMTP; 27 Aug 2007 18:33:42 +0200 X-Authenticated: #15125611 X-Provags-ID: V01U2FsdGVkX183UHgMfd43KE/ym3XZLDVslL9dS3TT9DFcQ+KR0I yaJx32HkMQBtcl Message-ID: <46D2FD9F.3020000@gmx.net> Date: Mon, 27 Aug 2007 18:36:47 +0200 From: Claudia Kosny User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: fetch first rows of grouped data Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200708/221 X-Sequence-Number: 29159 Hi there I have a list of events that take place in a certain city at a certain date. Now I would like to have the first two (ordered by date) events for each city. Is there a way to do this with one query? I am using PostgreSQL 7.4. Thanks for any tips. Claudia