paulostrom
Programmer
A while back (thread232-1437399)I needed help with a query that would return the highest 3 daily sales amounts from multiple locations.
r937 pointed me in the right direction with this query:
It has been working like a gem until I noticed that if the third and fourth highest daily sales amounts are equal, the query returns the four highest amounts instead of three.
Does anyone have any suggestions on how to adjust for this anomoly?
I'm using an Access DB.
r937 pointed me in the right direction with this query:
Code:
select location
, Daily_Sales
from Sales as T
where ( select count(*)
from Sales
where location
= T.location
and Daily_Sales
> T.Daily_Sales ) < 3
order
by location
, Daily_Sales desc
It has been working like a gem until I noticed that if the third and fourth highest daily sales amounts are equal, the query returns the four highest amounts instead of three.
Does anyone have any suggestions on how to adjust for this anomoly?
I'm using an Access DB.