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 2008 Forums
 Other SQL Server 2008 Topics
 YEAR Query - How to get the specific date

Author  Topic 

cengiz_styla
Starting Member

5 Posts

Posted - 2011-03-17 : 08:25:50
Hi, I have some date values in my db and I want to select every date with the year 2011..
I tried this one, but didn't get the one that I want...


SELECT problem, COUNT(*) AS Total
FROM tblProblems
WHERE (Department = 'Cooker') and YEAR(Date(2011))
GROUP BY Department , problem

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-03-17 : 10:08:58
YEAR(Your_DateColumn) = 2011


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -