Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Muj9
Yak Posting Veteran
75 Posts |
Posted - 2014-11-11 : 11:50:16
|
when you do a date diff this is the resultdt Day Week11/11/2014 00:00 0 010/11/2014 00:00 1 009/11/2014 00:00 2 008/11/2014 00:00 3 107/11/2014 00:00 4 106/11/2014 00:00 5 105/11/2014 00:00 6 104/11/2014 00:00 7 103/11/2014 00:00 8 102/11/2014 00:00 9 101/11/2014 00:00 10 231/10/2014 00:00 11 230/10/2014 00:00 12 229/10/2014 00:00 13 228/10/2014 00:00 14 227/10/2014 00:00 15 226/10/2014 00:00 16 225/10/2014 00:00 17 324/10/2014 00:00 18 323/10/2014 00:00 19 322/10/2014 00:00 20 321/10/2014 00:00 21 320/10/2014 00:00 22 319/10/2014 00:00 23 318/10/2014 00:00 24 417/10/2014 00:00 25 416/10/2014 00:00 26 415/10/2014 00:00 27 414/10/2014 00:00 28 413/10/2014 00:00 29 412/10/2014 00:00 30 411/10/2014 00:00 31 510/10/2014 00:00 32 509/10/2014 00:00 33 508/10/2014 00:00 34 507/10/2014 00:00 35 506/10/2014 00:00 36 505/10/2014 00:00 37 504/10/2014 00:00 38 603/10/2014 00:00 39 602/10/2014 00:00 40 601/10/2014 00:00 41 630/09/2014 00:00 42 629/09/2014 00:00 43 628/09/2014 00:00 44 6expected result dt Day Weeks11/11/2014 00:00 0 010/11/2014 00:00 1 009/11/2014 00:00 2 008/11/2014 00:00 3 007/11/2014 00:00 4 006/11/2014 00:00 5 005/11/2014 00:00 6 004/11/2014 00:00 7 103/11/2014 00:00 8 102/11/2014 00:00 9 101/11/2014 00:00 10 131/10/2014 00:00 11 130/10/2014 00:00 12 129/10/2014 00:00 13 128/10/2014 00:00 14 227/10/2014 00:00 15 226/10/2014 00:00 16 225/10/2014 00:00 17 224/10/2014 00:00 18 223/10/2014 00:00 19 222/10/2014 00:00 20 221/10/2014 00:00 21 320/10/2014 00:00 22 319/10/2014 00:00 23 318/10/2014 00:00 24 317/10/2014 00:00 25 316/10/2014 00:00 26 315/10/2014 00:00 27 314/10/2014 00:00 28 413/10/2014 00:00 29 412/10/2014 00:00 30 411/10/2014 00:00 31 410/10/2014 00:00 32 409/10/2014 00:00 33 408/10/2014 00:00 34 407/10/2014 00:00 35 506/10/2014 00:00 36 505/10/2014 00:00 37 504/10/2014 00:00 38 503/10/2014 00:00 39 502/10/2014 00:00 40 501/10/2014 00:00 41 530/09/2014 00:00 42 629/09/2014 00:00 43 628/09/2014 00:00 44 627/09/2014 00:00 45 626/09/2014 00:00 46 625/09/2014 00:00 47 624/09/2014 00:00 48 6is there a fuction which can help me?Thanks is advance |
|
Muj9
Yak Posting Veteran
75 Posts |
Posted - 2014-11-11 : 11:52:49
|
the bulit in SQL calculation works 9days as the last day for the 1st week but i would like 13days to be the last day of 1st week. Any idea? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-11-12 : 01:41:36
|
what is your definition of "weeks" ?starts on Sunday ? Monday ? or every 7 days from today ? KH[spoiler]Time is always against us[/spoiler] |
|
|
Muj9
Yak Posting Veteran
75 Posts |
Posted - 2014-11-12 : 06:18:00
|
0-6 days week07-13 days week114-20 days week221-27 days week328-34 days week435-41 days week542-48 days week6Thank you |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-11-12 : 06:42:13
|
dateadiff(day, [date], getdate()) / 7 as week_no KH[spoiler]Time is always against us[/spoiler] |
|
|
Muj9
Yak Posting Veteran
75 Posts |
Posted - 2014-11-12 : 08:09:58
|
Thank you |
|
|
|
|
|