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

html - Cut text on left side inside button while centering -

plugins - CodeIgniter support on netbeans 8.0 -

php - Selecting items from MySQL for a status update feed efficiently while accounting for possible spam -