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.

Community
  • 1
  • 1
  • Where are you getting the sales number? What is the relationship between `sales` and `products`? – PaulFrancis Jun 16 '15 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. – Dinesh Sundar Jun 16 '15 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? – Mark C. Jun 16 '15 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. – Newd Jun 16 '15 at 19:23

1 Answers1

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)
Dportology
  • 836
  • 1
  • 9
  • 32