sql server - SQL to Fetch records in period between every 15 days -


i have 2 lakhs of data in database,need fetch record based on 'uploaddatetime' (column in database)of every 15 days.for example,

date               number of records. april 1st-15th            20 april 16th-30th           40 may 1st 15th           1000 may 16th 31st          4000 

till date,have idea fetch data using microsoft sql-2008 r2

you can this

select  case  when date_col>='20130401' , date_col<'20130416' 'april 1st-15th' when date_col>='20130416' , date_col<'20130501' 'april 16th-30th' . . date_range end count(*) total table group  when date_col>='20130401' , date_col<'20130416' 'april 1st-15th' when date_col>='20130416' , date_col<'20130501' 'april 16th-30th' . . end 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -