Re: Selecting top N percent of records.

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: Darren Duncan <darren(at)darrenduncan(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting top N percent of records.
Date: 2010-10-18 00:03:29
Message-ID: AANLkTikznm=5rqtNZ1QH9k3yYtmfv6Cn3puwRuNzT_cK@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 18, 2010 at 12:53 PM, Darren Duncan <darren(at)darrenduncan(dot)net> wrote:
> Tim Uckun wrote:
>>
>> Is there a way to select the top 10% of the values from a column?
>>
>> For example the top 10% best selling items where number of sales is a
>> column.
>
> The top 10% would be a variable number of records.  Is that what you want,
> or would you rather, say, just see the top N items?

Yes this is what I want. I don't care how many records I pull up (well
I might want to put a LIMIT on them). I want the top 10%

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Uckun 2010-10-18 00:06:19 Re: Selecting top N percent of records.
Previous Message Peter Geoghegan 2010-10-17 23:56:02 Re: Selecting top N percent of records.