Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:26:18+00:00 2026-06-06T04:26:18+00:00

I have a query pulling the last six months of data from a table

  • 0

I have a query pulling the last six months of data from a table which has a column, UseDates (so as of today in June, this table has dates for December 2011 through May 2012).

I wish to include a “rank” column that associates a 1 to all December dates, 2 to all January dates, etc — up to 6 for the dates corresponding one month prior. If I were to open up this query a month from now, the 1 would then be associated with January, etc.

I hope this makes sense!

Example, if I ran the query right now

UseDate        Rank
12/31/2011     1
1/12/2012      2
...
5/23/2012      6

Example, if I ran the query in August:

UseDate        Rank
2/16/2012      1
3/17/2012      2
...
7/21/2012      6

Example, if I ran the query in March:

UseDate        Rank
9/16/2011      1
10/17/2011     2
...
2/24/2012      6
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:26:20+00:00Added an answer on June 6, 2026 at 4:26 am
    SELECT
        UseDates,
        DateDiff("m", Date(), UseDates) + 7 AS [Rank]
    FROM YourTable;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Editable Data grid which is pulling data from a SQL query
I have an INSERT query that is pulling data from two tables and inserting
I have query table copyQuery which has Soil Condition has one of the columns,
I can't figure this out. I have a query pulling data from a couple
I have a LINQ2SQL Query: //Pulling the Product_ID from the PlanMaster Table from WebEnroll
I have a MS SQL Query that is pulling data via from a remote
I have a cakePHP application that is pulling data from two different databases, which
I have table tree. I have query: SELECT * FROM tree WHERE pid =10
I have a Content Query Webpart (CQWP) pulling the URL and title from a
I have an sql query pulling a few results from different tables, one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.