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

  • Home
  • SEARCH
  • 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 7087137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:38:12+00:00 2026-05-28T07:38:12+00:00

Hello all I am using MS SQL Server 2008 R2 and needed some help

  • 0

Hello all I am using MS SQL Server 2008 R2 and needed some help with a small query

Here is my table:

Orders
-----------------
OrderID  Date(datetime)  Quantity

I need to find the avg, max and min quantity of each month. and also display the YEAR and Month
Because of thee requirements I was going to take the aproach of grouping by Month and then getting avg max and min through this. Is it possible? here is what i have so far

    Select YEAR(Orders.Date), MONTH(Orders.Date)
    From Orders
  • 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-28T07:38:12+00:00Added an answer on May 28, 2026 at 7:38 am

    Assuming that you want to group by month and year, you can do it like this:

    select Year(Orders.Date) as 'Year',
           MONTH(Orders.Date) as 'Month',
           avg(Quantity) as 'Average',
           max(Quantity) as 'Max',
           min(Quantity) as 'Min'
    from Orders
    group by YEAR(Orders.Date), MONTH(Orders.Date)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am working on a SQL database Using Microsoft SQL server 2008 R2
Hello all I'm using NSXMLParser to parse some xml data. I'm using this data
Hello I have table in my database holding some browser information I'm currently using
NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
Hello friends i need a book/ tutorials for rails without using scoffold. All the
How could I achieve the following: document.all.regTitle.innerHTML = 'Hello World'; Using jQuery where regTitle
hello all I have a small dialog which I created dynamically, which has a
I am using the following SQL Server statement to insert records and return the
Hello I am developing one wpf application. I am using linq to sql for
I have got hold of a sql server 2008 developer edition and this is

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.