Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query to filter current year plus m/d - 12/31

Author  Topic 

PolarBear
Starting Member

5 Posts

Posted - 2010-06-10 : 10:52:32
I have a table with date time stamp field. This table contains multiple records for the same ID. I need to select all records that have the "current year" and also include the month = 12 and date = 31 and the latest time. Looking for assistance with proper select statement to filter this information.

Any assistance would be appreciated.

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-06-10 : 10:55:43
[code]

declare @f datetime

select @f = GETDATE()

select MONTH(@f), YEAR(@f)[/code]

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -