I am using the following code in ACCESS 2010 to rank ~30000 rows from a table. However it takes around 15 minutes to do the ranking (I have to do this for 5 more columns and it could easily take more than an hour). I need these columns for further processing and hence tried creating a new table. I have also tried appending and updating to existing tables. Everything takes the same time. Am I missing something obvious here that could make it work faster?
SELECT MasterTable.Sales, (SELECT Count(*)+1 as HowMany
From MasterTable AS Dupe
WHERE Dupe.Sales > MasterTable.Sales) AS SalesRank INTO tableRank
FROM MasterTable;
Details on the MasterTable
:
11 columns. 1 primary key (Text). 5 parameters (Sales
SalesQty
Profit
Hits
Cost
, all numeric). Ranks of 5 parameters(like SalesRank
and so on)
30,000 rows