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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:15:40+00:00 2026-05-20T09:15:40+00:00

In my db, I have a column for date (formatted as 3-1-2011) and a

  • 0

In my db, I have a column for date (formatted as 3-1-2011) and a column for quantity. I want to grab the quantity for all results in the specified month up to a certain day.

Currently I’m using, the following:

SELECT SUM(quantity) FROM record WHERE date LIKE '"+month+"-%-"+year+"'"

This works to get the sum quantity from all records in that month/year. Now I’m looking at getting the sum only up to the specified day. So if day = 15, I want the sum quantity of all days in that month/year up to the 15th. How would I go about this?

  • 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-20T09:15:40+00:00Added an answer on May 20, 2026 at 9:15 am

    Why not do something like this:

    "SELECT SUM(quantity)
     FROM record
     WHERE date IS BETWEEN '"+month+"-01-"+year+"'
                       AND '"+month+"-"+end_day+"-"+year+"'" 
    

    As long as month and day are always stored as two digits (i.e. “03-01-2011” not “3-1-2011”) this will work fine. If your data is not in this format, it shouldn’t be hard to convert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DATE column that I want to round to the next-lower 10
I have one Date column, formatted '17/03/2012'. I would like to be able select
How to get the formatted date in SQL Server CE? I have a column
I have a date column where the date is displayed in the format 2009-11-18
I have a date column in a data frame in chr format as follows:
In mysql database i have this column called: Name: Date Type: datetime I have
If I have table with a Date column called myDate , with values like
I have this table: ID(INT) DATE(DATETIME) Under the DATE column there are a lot
I have to get dates in my date column in 4 quarters Q1,Q1,Q3,Q4 using
I have a pandas DataFrame with a date column. It is not an index.

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.