I’m really having a hard time to write the stored procedure.
Here is the case.
I’m joining several tables in a stored procedure and store it in a temporary table.
Below is the illustration of the result given by the stored procedure :
CLIENT Request Month Total
Client A A 1 1
Client A B 1 3
Client A C 1 9
Client A D 1 4
Client A E 1 6
Client A A 2 6
Client A B 2 9
Client A C 2 1
Client A D 2 3
Client A E 2 2
Client B A 1 3
Client B B 1 7
Client B C 1 9
Client B D 1 8
Client B E 1 4
Client B A 2 5
Client B B 2 8
Client B C 2 1
Client B D 2 1
Client B E 2 3
My question is, how can I get the TOP N (eg : top 3) for each clients per month based on the highest total request.
I’m going to use the stored procudere for a chart in Reporting Service, i’m also having a hard time using the filter function in the chart, so i think there’s any possibilities to filter it at the first place from the sql query.
I hope me and the illustration above explained the problem clearly. I really appreciate every responses from you.
Thanks so much before
1 Answer