Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Top n records for each month/year, grouped by month year

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-18 : 08:11:13
Jeremy writes "Based upon the following table

DATE        PID
07/15/2000 3
07/15/2000 4
07/15/2000 8
07/15/2000 3
07/15/2000 3
07/15/2000 6
07/15/2000 6
07/15/2000 4
08/15/2000 3
08/15/2000 3
08/15/2000 4
08/15/2000 5
08/15/2000 9
08/15/2000 9
08/15/2000 4



I need to be able to return the top 2 PIDS in each month/year. By using the TOP function I just get two records when I need to get the top two in July 2000, August 2000, etc. Any suggestions?"
   

- Advertisement -