X-Original-To: pgsql-sql@postgresql.org Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id CE172475FF1 for ; Wed, 5 Mar 2003 08:24:25 -0500 (EST) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Wed Mar 05 14:24:28 2003 +0100 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id OAA19552; Wed, 5 Mar 2003 14:24:27 +0100 (MET) Message-ID: <3E65FA8B.352136E@rodos.fzk.de> Date: Wed, 05 Mar 2003 14:24:27 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: cprice@hrdenterprises.com Subject: Re: LIMIT and SUBQUERIES Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/150 X-Sequence-Number: 12190 > > So anyway, I have the query that is working - but it returns all > records for all owners, when what I really want to do is return the > top 5 per each owner. > I've seen a lot of questions like this on the list before about filtering result sets. Within the most replies, people were told to use middleware stuff like perl, awk, sed, ... to filter out unwanted rows, because SQL was not intended to do so. Incidentally, I've seen http://techdocs.postgresql.org/guides/SetReturningFunctions Maybe this is more useful than telling you 'use a script'. Regards, Christoph