Top 5 products per customer

karinos

Registered User.
Local time
Today, 16:00
Joined
Jan 6, 2008
Messages
24
Hi There,
I have created this query and i want to return the top 5 suppliers per LOB. It is returning something but it is not the top 5. I want to limit only to return the top 5. Pls. help and thanks. See attached file.
 

Attachments

In (select top 5 [Detail].[SumOfAnnualNonContractSpend] from [Detail] where [LOB].[Line of Business] = [Detail].[Line of Business] Order by [SumOfAnnualNonContractSpend]Desc)


set this statement in SumOfAnnualNonContractSpend criteria
 
you will 57 records instead of 65 because some LOB have maximum 3 or 4 records...and also there are suppliers ranked two places in top 5
 
Last edited:
The query is not working after i put this in the criteria:
In (select top 5 [Detail].[SumOfAnnualNonContractSpend] from [Detail] where [LOB].[Line of Business] = [Detail].[Line of Business] Order by [SumOfAnnualNonContractSpend]Desc)
did you test it and see if it is working? I am getting error which says "data mismatch"
 
you must put this statement in SumOfAnnualNonContractSpend criteria.....
 

Users who are viewing this thread

Back
Top Bottom