Subject Re: 4 most recent detail rows per master row
Author Milan Babuskov
gorepj wrote:
> I have a master and detail table. The detail table contains a date
> column. With a single SQL query I would like to return the four most
> recent rows in the detail table for each master row.

Assuming that detail and master and joined on field called "id":

select d.*
from detail d
join master m on =
where 4 > (
select count(*)
from detail d2
where =
and <

Milan Babuskov