Make sure you have indexes on Branch and LNamt fields.
It could be the volume of records you are processing. Or it could be a
bad query on my part.
You might try an experiment. Create and save a query that returns
records for just one branch and ACNo.
Replace the references to YourTable with references to the query. See
if that runs. If it does then the query is correctly constructed and
the problem is the volume of records, especially if you have not
indexed at least branch and LNamt. Indexing ACNo may also help.
SELECT A.Branch, A.ACNO, A.LNamt
FROM [QueryName] As A LEFT JOIN [QueryName] As B
ON A.Branch = B.Branch
AND A.LNamt > B.LNamt
GROUP BY A.Branch, A.ACNO, A.LNamt
HAVING Count(B.Branch) <= 19
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Thanks for your response.
I've tried the query but the query is still running more than 3 hours
till now...
What could be the problem....
:
YOU might TRY the following query. I think it will work
SELECT A.Branch, A.ACNO, A.LNamt
FROM [YourTable] As A LEFT JOIN [YourTable] As B
ON A.Branch = B.Branch
AND A.LNamt > B.LNamt
GROUP BY A.Branch, A.ACNO, A.LNamt
HAVING Count(B.Branch) <= 19
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County