Re: Top Records with multiple groupings
From: Mark Senibaldi (MarkSenibaldi_at_discussions.microsoft.com)
Date: 02/23/05
- Next message: Mark Senibaldi: "Re: Top Records with multiple groupings"
- Previous message: James Stephens: "Running Copy Command in background"
- In reply to: John Spencer (MVP): "Re: Top Records with multiple groupings"
- Next in thread: Mark Senibaldi: "Re: Top Records with multiple groupings"
- Messages sorted by: [ date ] [ thread ]
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
>
- Next message: Mark Senibaldi: "Re: Top Records with multiple groupings"
- Previous message: James Stephens: "Running Copy Command in background"
- In reply to: John Spencer (MVP): "Re: Top Records with multiple groupings"
- Next in thread: Mark Senibaldi: "Re: Top Records with multiple groupings"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|