Hello all,
Is there a way to rank the following using a select query? The following is an excerpt from a larger table (over 100,000 records).
Store Product Jan $ Feb $
NY Juice 491 147
NY Chicken 341 144
NY Milk 1,085 128
NY Cosmetics 431 37
NY Beef 344 68,731
NY Eggs 119 7,152
NY Fish 117 4,999
NJ Juice 104 2,377
NJ Chicken 30 48
NJ Milk 55,687 31
NJ Cosmetics 55,687 403
NJ Beef 4,050 481
NJ Eggs 1,926 335
NJ Fish 39 1,064
CA Beef 25 422
CA Eggs 327 337
CA Fish 43 117
Result would be:
Store Product Jan $ Feb $ Jan Rank Feb Rank
NY Juice 491 147 2 4
NY Chicken 341 144 5 5
NY Milk 1,085 128 1 6
NY Cosmetics 431 37 3 8
NY Beef 344 68,731 4 1
NY Eggs 119 7,152 6 2
NY Fish 117 4,999 7 3
NJ Juice 104 2,377 4 1
NJ Chicken 30 48 6 6
NJ Milk 55,687 31 1 7
NJ Cosmetics 55,687 403 1 4
NJ Beef 4,050 481 2 3
NJ Eggs 1,926 335 3 5
NJ Fish 39 1,064 5 2
CA Beef 25 422 3 1
CA Eggs 327 337 1 2
CA Fish 43 117 2 3
Any help will be greatly appreciated.
Thanks.
Is there a way to rank the following using a select query? The following is an excerpt from a larger table (over 100,000 records).
Store Product Jan $ Feb $
NY Juice 491 147
NY Chicken 341 144
NY Milk 1,085 128
NY Cosmetics 431 37
NY Beef 344 68,731
NY Eggs 119 7,152
NY Fish 117 4,999
NJ Juice 104 2,377
NJ Chicken 30 48
NJ Milk 55,687 31
NJ Cosmetics 55,687 403
NJ Beef 4,050 481
NJ Eggs 1,926 335
NJ Fish 39 1,064
CA Beef 25 422
CA Eggs 327 337
CA Fish 43 117
Result would be:
Store Product Jan $ Feb $ Jan Rank Feb Rank
NY Juice 491 147 2 4
NY Chicken 341 144 5 5
NY Milk 1,085 128 1 6
NY Cosmetics 431 37 3 8
NY Beef 344 68,731 4 1
NY Eggs 119 7,152 6 2
NY Fish 117 4,999 7 3
NJ Juice 104 2,377 4 1
NJ Chicken 30 48 6 6
NJ Milk 55,687 31 1 7
NJ Cosmetics 55,687 403 1 4
NJ Beef 4,050 481 2 3
NJ Eggs 1,926 335 3 5
NJ Fish 39 1,064 5 2
CA Beef 25 422 3 1
CA Eggs 327 337 1 2
CA Fish 43 117 2 3
Any help will be greatly appreciated.
Thanks.