Subject Re: [firebird-support] 4 most recent detail rows per master row
Author Nick Upson
select first 4 from master m join detail d on m.id = d.id order by
datecolumn desc

On 21/09/2007, gorepj <pgore@...> 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. I've tried
> various ways but most resulting in a 'multiple rows in a singleton
> select error'
>
> I'm using FB1.5
>
> Regards
> Peter Gore
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>