Subject | Re: 4 most recent detail rows per master row |
---|---|
Author | gorepj |
Post date | 2007-09-21T15:49:32Z |
--- In firebird-support@yahoogroups.com, "Nick Upson"
<nick.upson@...> wrote:
Thanks Nick but that only gives me 4 rows total, I need 4 rows for
each row in the master table.
Regards
Peter Gore
<nick.upson@...> wrote:
Thanks Nick but that only gives me 4 rows total, I need 4 rows for
each row in the master table.
Regards
Peter Gore
>most
> 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
> > 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
> >
> >
> >
> >
>