Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-29
2
Medium Priority
?
236 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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

963 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