sql - How to only return in certain increments of days -


i'm trying return every 14 days starting 12/31/2010 12/31/2011, statement doesn't seem work

select distinct      convert(varchar,month(time_stamp)) + '/' +          convert(varchar,day(time_stamp)) report time_stamp '%2011%' ,      convert(varchar(20),datediff(d,'2010-12-31',time_stamp) / 14) not '%.%' order 1 

this doesn't seem work because returns oddball dates...

1/1 1/10 1/11 

when should return every 14 days, this...

1/14 1/28 2/11 

and on..

anyone know cleaner method, works?

change modulo value offset start date

select distinct      convert(varchar,month(time_stamp)) + '/' +          convert(varchar,day(time_stamp)) report      time_stamp '%2011%'      ,           datepart(dayofyear, time_stamp) % 14 = 0 order 1 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -