From: | cprice(at)hrdenterprises(dot)com (Chris) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | LIMIT and SUBQUERIES |
Date: | 2003-03-03 18:52:53 |
Message-ID: | a1a26a5.0303031052.55f30f7b@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
This question may be a bit confusing, and it is entirely possible that
I am going about it the wrong way, but any suggestions would be much
appreciated. I'm trying to query a table of records that has a
(simplified) structure like the following:
owner int
description text
amount double
I want to do a select that returns the TOP 5 records ordered by
amount, PER OWNER. I can easily construct this SQL query, the problem
arises in the fact that I want to have groups of the top five per
owner (an owner can obviously have more than 5 records, but I just
want the top 5 for each).
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.
Any suggestions?
Thanks
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2003-03-03 18:55:42 | Re: Hwo to set timeout for PHP persistent connections |
Previous Message | Joel Rodrigues | 2003-03-03 18:33:08 | weird time-space problem wih the list |