Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2004, 09:49 AM
Authorized User
Join Date: Jun 2003
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default return record count by quarter


I have a simple table with a Submitted datetime column. I would like to return a COUNT of records, by quarter, to my web page. I use standard yearly quarters of Jan-Mar = Q1, Apr-Jun = Q2, Jul-Sep = Q3, Oct-Dec = Q4. Based on the current date GETDATE() and the date in the Submitted column of my table, how can I determine to COUNT of records in the current quarter?

Thanks you,

Reply With Quote
  #2 (permalink)  
Old June 29th, 2004, 11:24 PM
Friend of Wrox
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

You can use this.

SELECT count(*) FROM YOURTABLE WHERE datepart(q,Submitted)=datepart(q,getdate())

- Vijay G
Strive for Perfection
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
record count help jpaul VB Databases Basics 2 January 22nd, 2008 02:49 PM
Return one record per value fizzerchris SQL Server 2005 4 August 17th, 2007 09:31 PM
Count, sum, count a value, return records CongoGrey Access 1 April 18th, 2005 02:25 PM
How to get "SELECT COUNT(*)" return information? datagram ASP.NET 1.0 and 1.1 Basics 3 December 23rd, 2004 01:21 AM
sql to return distinct count pbgurl Access VBA 2 October 29th, 2004 06:29 AM

All times are GMT -4. The time now is 08:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.