Re: Return 30% of results?

From: David Fetter <david(at)fetter(dot)org>
To: nick <nboutelier(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Return 30% of results?
Date: 2009-09-19 15:05:59
Message-ID: 20090919150559.GA31599@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Sep 19, 2009 at 12:27:10AM -0700, nick wrote:
> On Sep 18, 3:40 pm, spam_ea(dot)(dot)(dot)(at)gmx(dot)net (Thomas Kellerer) wrote:
> > Nick wrote on 18.09.2009 23:31:> Is there a way to return a percentage of the rows found? I tried
> > > window functions but get an error...
> >
> > > ERROR:  syntax error at or near "OVER"
> >
> > > SELECT id, cume_dist FROM (
> > >   SELECT id, cume_dist() OVER (ORDER BY id) FROM employees
> > > ) s
> > > WHERE cume_dist < 0.3
> >
> > Works for me. Are you sure you are using Postgrs 8.4?
> > (Windowing functions are not available in earlier versions)
> >
> > Regards
> > Thomas
> >
> > --
> > Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> > To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general
>
> Yeah, im actually not using 8.4. Any other alternatives?

The easiest way would be to upgrade to 8.4 because the workarounds for
previous versions are complicated and bug-prone.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dirk Riehle 2009-09-19 15:10:01 Open Positions in Ph.D. Studies in Open Source at the University of Erlangen, Germany
Previous Message Merlin Moncure 2009-09-19 15:00:56 Re: haversine formula with postgreSQL