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 789801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:34:53+00:00 2026-05-14T21:34:53+00:00

I am planning to get a report for a table with following table structure:

  • 0

I am planning to get a report for a table with following table structure:

ID              RequestDate
-----------------------------
1               2010/01/01
2               2010/02/14
3               2010/03/20
4               2010/01/07
5               2009/03/31

I want the results as:
I

D_Count    RequestDate               Sum
-----------------------------------------
2               2010/01              2
1               2010/02              3
2               2010/03              5

Pls help.

  • 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-05-14T21:34:53+00:00Added an answer on May 14, 2026 at 9:34 pm

    You just have to group by the year and month date parts of the table to get the count per month and year:

    select
       count(*), datePart("yy", requestDate) + "/" + datePart("mm", requestDate)
    from table1
    group by 
    datePart("yy", requestDate), datePart("mm", requestDate)
    

    To get the sum of these you would have to have a temp table and then update that temp table sum column with the running total.

    create table #temp ( rowID identity(1,1) int, dateCount int, yearMonth varchar(50), runningTotal int)
    
    insert into #temp ( dateCount, yearMonth, runningTotal ) 
        select
           count(*), datePart("yy", requestDate) + "/" + datePart("mm", requestDate)
        from table1
        group by 
        datePart("yy", requestDate), datePart("mm", requestDate)
    
    update #temp set runningTotal = (select sum(dateCount) from #temp a where a.rowID < #temp.rowID)
    
    select * from #temp 
    
    drop table #temp 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following query to get the results which i demonstrated SELECT
I planning my inaugural data load into GAE and really want to get my
I am planning a new Django project and want to get everything right and
We are planning a rewrite and I want to get the latest tools to
I consider myself an experienced Java developer and am planning to get started with
Our company is planning to move to 64 bit JVM in order to get
I am planning to build an application that will get a large amount of
I am building the site and planning on implementing OpenID. I can get an
I have a pretty overview on the TCP/IPv4 stack. I am planning to get
To get more into django programming I'm planning to create a google maps mashup,

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.