Solved

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

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

623 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