1

I am working on a project in ACCESS 2010 that requires me to give a rank to 30000 products based on their sales. I have tried using a query to do the ranking and it takes a long time. (Please find codes at Making the ranking query efficient)

I figured out that instead, I can just sort the table based on the Sales column and add a field with numbers 1 to 30000.

So is there a way to add such a column, i.e. a column without any relationship to the existing table.

4
  • Where are you getting the sales number? What is the relationship between sales and products? Commented Jun 16, 2015 at 15:43
  • the 'sales' and 'products' are a part of a single table. The table has 11 columns. The product name - Primary key 5 Parameters to be ranked (for example sales, hits, profit, etc) 5 columns to hold the different ranks. Commented Jun 16, 2015 at 15:53
  • I'm having a hard time understanding where you're at as far as your progress. Do you have a method for the ranking, and you just want to add a column? Or do you need to know how to get the ranking into the table? Commented Jun 16, 2015 at 17:14
  • Pretend you have a query that has been sorted how you want it. Then adding a column that simply starts row 1 and counts up till the last row. That is what I believe OP is trying to accomplish. Commented Jun 16, 2015 at 19:23

1 Answer 1

1

Add a field to the actual table? If that's the case, make a table and run this query:

ALTER TABLE yourTableName
ADD COLUMN yourColumnName AUTOINCREMENT(1, 1)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! It worked great with some pre-processing and post-processing. But it saves a lot of execution time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.