query advice

From: "Nathanial Mayweather" <nmayweather(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: query advice
Date: 2007-03-13 20:49:13
Message-ID: BAY123-F3390B49529E765B7CD82A7AC7C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm stuck on a query, I'm hoping someone can point me to the obvious

I need to limit the results of a query based on 2 criteria:
1- total rows grouped by column_a
2- total rows all

given:
books: id , author , subject , title

i need to

SELECT * FROM books WHERE subject= 'database'
Limit to : no more than 10 records per 'author'
Limit to : 100 records total

I'm really rusty on my sql this week.

Any pointers would be appreciated.

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/

Browse pgsql-general by date

  From Date Subject
Next Message Dhaval Shah 2007-03-13 21:23:41 Questions regarding generating the WAL File.
Previous Message Tom Lane 2007-03-13 20:09:05 Re: Restart after poweroutage