N
newkid via AccessMonster.com
Hi All,
Please find the time to help me out - I have the following query:
----------------------------------
SELECT TR.[Rep ID], TR.[SumOfVoice GA], TR.[SumOfData GA], TR.[Total GA], TR.
[MSD Code], TR.[Primary]
FROM zz_ReportingSummary AS TR
WHERE (((TR.[Total GA]) In (SELECT TOP 10 [Total GA]
FROM zz_ReportingSummary
WHERE [Rep ID] = TR.[Rep ID]
ORDER BY [Rep ID],[Total GA] DESC)))
ORDER BY [Rep ID], [Total GA] DESC , TR.[MSD Code], TR.[Primary];
-----------------------------------
Primary is an auto number feild that i used as the primary key
MSD code is also unique for 99% of the records
My issue is I only need the top 10 Total GA, regardless of ties - there arent
any business rules for ties, I just need the highest ten and dont care about
the ties in 10th place. I know your suppose to order by the primary key to
solve this issue and I have, yet it still isnt working.
Pardon my coding this is the first time I've written code based on what I've
seen online.
Thanks
Please find the time to help me out - I have the following query:
----------------------------------
SELECT TR.[Rep ID], TR.[SumOfVoice GA], TR.[SumOfData GA], TR.[Total GA], TR.
[MSD Code], TR.[Primary]
FROM zz_ReportingSummary AS TR
WHERE (((TR.[Total GA]) In (SELECT TOP 10 [Total GA]
FROM zz_ReportingSummary
WHERE [Rep ID] = TR.[Rep ID]
ORDER BY [Rep ID],[Total GA] DESC)))
ORDER BY [Rep ID], [Total GA] DESC , TR.[MSD Code], TR.[Primary];
-----------------------------------
Primary is an auto number feild that i used as the primary key
MSD code is also unique for 99% of the records
My issue is I only need the top 10 Total GA, regardless of ties - there arent
any business rules for ties, I just need the highest ten and dont care about
the ties in 10th place. I know your suppose to order by the primary key to
solve this issue and I have, yet it still isnt working.
Pardon my coding this is the first time I've written code based on what I've
seen online.
Thanks