Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

totals by month between 1/1/2007 and 12/31/2007

Posted on 2006-11-29
2
Medium Priority
?
233 Views
Last Modified: 2008-02-01
hello all,

I need to pull records from my table totaled by month between the date ranges of 1/1/2007 and 12/31/2007.

My table is called brfmaster, and my date field is called MDATE. I need to pull totals for each month based on MDATE basically, and need some help with the syntax.

thnx

mack1er
0
Comment
Question by:mack1er
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 18037275
select datepart(month, mdate) m, count(*)
from brfmaster
where mdate >= convert(datetime, '2007-01-01', 120)
and mdate < convert(datetime, '2008-01-01', 120)
group by datepart(month, mdate)
0
 

Author Comment

by:mack1er
ID: 18037337
WOW that was fast! Thank you
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question