PAGANED
asked on
SQL Server 2008 : Tricky Top 5 Rows Problem
I have a tricky problem I am trying to solve with either Multiple Views or perhaps a Procedure to create a temp table that is returned...
.
There is a Report that Shows the Last 5 comment entries for every Project
.
There is a table : tblFolderComments
This table has fields :
- FolderCommentID (Key)
- ProjectID
- FolderComment
.
.
These Projects can have any number of comments from 0 to 20+
I need to create something where I only get the most recent 5 [FolderComments] from each Project
.
I thought this was going to be simple ... but it has turned out not to be
.
.
There is a Report that Shows the Last 5 comment entries for every Project
.
There is a table : tblFolderComments
This table has fields :
- FolderCommentID (Key)
- ProjectID
- FolderComment
.
.
These Projects can have any number of comments from 0 to 20+
I need to create something where I only get the most recent 5 [FolderComments] from each Project
.
I thought this was going to be simple ... but it has turned out not to be
.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
nevermind, I see what you need now is the same thing but for all ProjectIDs at once, correct?
ASKER
Not quite .. I wish it was that easy
.
you are including a ProjectID filter , where I need ALL ProjectIDs
.
All ProjectIDs , not a single one
.
.
you are including a ProjectID filter , where I need ALL ProjectIDs
.
All ProjectIDs , not a single one
.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dude .. you are Awesome !
ASKER
Tim_cs : Awesome quick SQL code