sql - Dates by quarter -


i count number of birthdays quarters in sql server i.e. between jan 1 - march 31, april 1 - june 30, july 1 - sep 30 & oct 1 - dec 31.

please me date function in sql server this.

i pass bdate datetime . want use bdate populate 4 fields of type int counts number of birthdays in each quarter.

thanks.

as long "bdate" column datetime, can achieve quite using query:

select datepart(quarter,bdate), count(*) table1 group datepart(quarter,bdate) order datepart(quarter,bdate) asc 

here's working fiddle using random data: http://sqlfiddle.com/#!6/7734b/1


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -