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
Post a Comment