Home > DeveloperSection > Forums > How can I Select data after 7 days interval using SQL Server
Garry Winogrand
Garry Winogrand

Total Post:24

Points:168
Posted on    October-16-2013 6:55 AM

 MSSQL Server MSSQL Server 
Ratings:


 1 Reply(s)
 825  View(s)
Rate this:

I have a table with Date_Interval in that table have two column. How can I select id's of 7 days interval?

My data is:

date                   id

2013-07-01      11

2013-07-02      22

2013-07-03      33

2013-07-04      33

2013-07-05      44 

2013-07-06      44     

2013-07-07      45 

2013-07-08      46 

2013-07-09      47

2013-07-10      48

2013-07-11      48

2013-07-12      49

2013-07-13      50

2013-07-14      51

2013-07-15      52

2013-07-16      52

2013-07-17      53

2013-07-18      53

2013-07-19      54

How can I do this please suggest me:

date                   id

2013-07-01      11

2013-07-08      46

2013-07-15      52

Thanks!


Aaron Douglas
Aaron Douglas

Total Post:20

Points:140
Posted on    October-16-2013 7:35 AM

SELECT date,id FROM table1 GROUP BY WEEK('date', 1)

Don't want to miss updates? Please click the below button!

Follow MindStick