Tuesday, May 27, 2014

Find the Current Quarter

You can make the query simple with a calendar table to retrieve the quarter that equals to today's quarter (year).You can construct it with a list of all months in a column in a query too and retrieve like below.



select distinct datename(month, dtColumn)
from yourtable
where datepart(q, dtColumn) =datepart(q, getdate())




No comments:

Post a Comment