tsql - SQL Server how to get Count of a field for the current Quarter from Date? -


i have hard time assembling sql statement. scenario/requirement this: need count of field in current quarter.

select count(fieldname) hits  tablename  dateposted = (current quarter) 

i no of hits/count current quarter.

is possible?

select count(fieldname) hits  tablename datepart(q,dateposted) = datepart(q,getdate()) , year(dateposted) = year(getdate()) 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -