Re: LIMIT and SUBQUERIES - Mailing list pgsql-sql

From Greg Stark
Subject Re: LIMIT and SUBQUERIES
Date
Msg-id 87fzq196t5.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: LIMIT and SUBQUERIES  (Christoph Haller <ch@rodos.fzk.de>)
List pgsql-sql
Christoph Haller <ch@rodos.fzk.de> writes:

> >
> > 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.

This is the same problem as the "ranking" problem that I mentioned earlier.

http://archives.postgresql.org/pgsql-sql/2003-03/msg00013.php

Essentially we would need a kind of feature that has some similarities to user
defined aggregates but is not exactly the same thing. The feature doesn't
currently exist, and I haven't seen it in order databases, so I don't even
know exactly what it would look like.

-- 
greg



pgsql-sql by date:

Previous
From: Achilleus Mantzios
Date:
Subject: Re: sort / limit / range problem
Next
From: patrick
Date:
Subject: upgrading from 7.1.2 to 7.3.2