Re: Top Records with multiple groupings

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mark Senibaldi (MarkSenibaldi_at_discussions.microsoft.com)
Date: 02/23/05


Date: Tue, 22 Feb 2005 18:23:03 -0800

Thanks for the response, but my SQL statement doesn't recognize Temp as a
table. I'm not exactly sure what a coordinated sub-query is, so I'm guessing
that might solve my problem?

Thanks.

"John Spencer (MVP)" wrote:

> Use a coordinated sub-query to identify the records you want.
>
> SELECT [Name],[Date],Score
> FROM YourTable
> WHERE YourTable.[Date] in
> (SELECT Top 10 Temp.[Date]
> FROM YourTable as Temp
> WHERE Temp.[Name] = YourTable.[Name]
> ORDER BY Temp.[Date] Desc)
>
> This will give you more than 10 items IF there are ties in the date for the last position.
>
>
>
> Mark Senibaldi wrote:
> >
> > Hi,
> > I am trying to return the top 10 records per grouping level. My table is
> > tblScores which contains NAME, DATE, SCORE. I am trying to return the
> > previous 10 scores per Name. Any idea on how I could do this.
> > --
> > MSS
>



Relevant Pages

  • Re: best way to increment an IntVar?
    ... guessing there is a good reason not to do it. ... var to a new object ... print,myintvar2 is temp) ...
    (comp.lang.python)
  • Re: PID vs. temp stability question
    ... group, for a longish time, thus raising the temp of the coffee pack. ... The pro barrista couldn't afford this luxury. ... I'm guessing that the pack temp increase would be fairly large, against a small debit in the adjoining metalwork. ...
    (alt.coffee)
  • Re: Fall 2006 - What to watch, assuming youre me
    ... Do we know it's "temp"? ... I don't know this for sure, I'm just guessing. ... Well tomorrow's show is about Dylan's return to Marco's life so probably ... - Chloe O'Brian, about Jack Bauer ...
    (rec.arts.tv)
  • Type mismatch
    ... guessing here but i think the problem is that your select ... IdBranch As Integer) ... >Dim temp As Date ... >have tried different data type in the function even using ...
    (microsoft.public.access.formscoding)
  • Re: Optimizing inline view
    ... your SQL statement _might_ look similar to this: ... yes I can create temp tableand break things up to ... Oracle is more iffy with picking the best join order. ... was wondering if there is a hint or more elegant way to tell Oracle "do ...
    (comp.databases.oracle.misc)