Solved

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

Posted on 2006-11-29
2
226 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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

828 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