473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MS Access Ranking (sum)

Helo, i use the code below to rank my table base on Gross (highest to lowest)


Code:
Expand|Select|Wrap|Line Numbers
  1. SELECT Sales.CategoryID, Sales.Gross, (Select Count(*) from qrySales Where [Gross] >[Sales].[Gross])+1 AS Ranking
  2. FROM qrySales AS Sales
  3. ORDER BY Sales.Gross DESC;
But my problem is If I want Rank my Table base on Sum Of Gross per each Customer with a date range of 1/1/2007 to 1/31/2007?

kindly help me what code should i write pls?
Dec 19 '07 #1
1 1979
puppydogbuddy
1,923 Expert 1GB
Helo, i use the code below to rank my table base on Gross (highest to lowest)


Code:
Expand|Select|Wrap|Line Numbers
  1. SELECT Sales.CategoryID, Sales.Gross, (Select Count(*) from qrySales Where [Gross] >[Sales].[Gross])+1 AS Ranking
  2. FROM qrySales AS Sales
  3. ORDER BY Sales.Gross DESC;
But my problem is If I want Rank my Table base on Sum Of Gross per each Customer with a date range of 1/1/2007 to 1/31/2007?

kindly help me what code should i write pls?
Try this (replace field names I used with yours):
Expand|Select|Wrap|Line Numbers
  1. Select CustomerID, CustomerName, Sum(Gross) As GrossSales,
  2. (Select Count(*) from qrySales Where GrossSales > GrossSales)+1 AS Ranking
  3. From qrySales
  4. Where SaleDate Between #1/1/2007# And #1/31/2007#
  5. Group By CustomerID, CustomerName
  6. Order By Ranking
Dec 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Marco Alting | last post by:
Hi, I'm still confused about my queries, I want to do something is ASP that is easily done in Access. I'll post the Access queries below as a reference. The main idea is that the queries depend...
11
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will...
5
by: ED | last post by:
I currently have vba code that ranks employees based on their average job time ordered by their region, zone, and job code. I currently have vba code that will cycle through a query and ranks each...
6
by: sara | last post by:
I hope someone can help with this. Our director wants to have a report that will have the departments (Retail stores) across the top, stores down the side and the RANKING of the YTD dept sales...
5
by: Chris | last post by:
I was wodering if there was a way to rank numbers in a query like this #'s Rank 100 1 99 2 98 3 98 97 5 96 6 96
1
by: jjjoic | last post by:
Hi, I use Access 2003 to generate the back-end data for a ColdFusion report at work. The report is sorted by a column and based on the sorting, rankings are assigned to each row(i.e. the biggest...
0
debasisdas
by: debasisdas | last post by:
Rank:-assigns A Unique Number For Each Row Starting With 1,except For Rows That Have Duplicate Values,in Which Case The Same Ranking Is Assigned And A Gap Appears In The Sequence For Each Duplicate...
1
by: Paulo | last post by:
Hi, I need to create a ranking column wich will be the row number... it is the seller wich most sells... Ranking Seller Sum 1 Paul 2.212,00 2 Robert ...
2
by: kevinlhamiltonsr | last post by:
INSERT INTO ( CC, HeldPayAccounts, ASG, , Command, OrderNo, , ) SELECT .CC, .HeldPayAccounts, .ASG, ., .Command, .OrderNo, . AS Expr2, (Select count(.) from as where ((. >= .) and (. = ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.