Re: [GENERAL] Group by and limit

2010-11-03 Thread Dimitri Fontaine
Reid Thompson writes: > I only want the first 500 for each x. > Any tips or tricks someone might know would be appreciated. > I’m using postgres 8.3.7. http://troels.arvin.dk/db/rdbms/#select-top-n Consider using a more recent version of PostgreSQL, equipped with window functions! Regards, --

[GENERAL] Group by and limit

2010-11-02 Thread Reid Thompson
Reposting as I noticed that the original was in reply to a different subject. Hey Folks – have a coded myself into a corner yet? I have a situation with a select count / group by / order by query that I need to limit each group to 500 entries. Not seeing a way to do this in a single query, do