Hi,

Suppose that there are two tables book and author:

book
--------
id
title
author_id

author
---------
od
title

I want a query that returns all the books, but if there are more than
3 books with the same author_id, only 3 should be returned. For
example if this is the contents of the book table:

(1, "Book 1", 10)
(2, "Book 2", 10)
(3, "Book 3", 10)
(4, "Book 4", 10)
(5, "Book 1", 11)

these rows should be returned:

(1, "Book 1", 10)
(2, "Book 2", 10)
(3, "Book 3", 10)
(5, "Book 1", 11)

Any ideas how can I query this?

Thanks in advance,
Behrang Saeedzadeh


--

Behrang Saeedzadeh
http://www.jroller.com/page/behrangsa
http://my.opera.com/behrangsa

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to