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 |
|
psugak
Starting Member
4 Posts |
Posted - 2010-04-15 : 10:32:20
|
Does anyone know the syntax for querying the 19th day of last month to the 18th day of current month?Thanks! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-15 : 10:46:48
|
[code]select [19th day of previous month] = dateadd(month, datediff(month, 0, getdate()) - 1, 19 - 1), [18th day of current month] = dateadd(month, datediff(month, 0, getdate()), 18 - 1)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-15 : 10:50:08
|
| select dateadd(month,datediff(month,0,getdate())-1,18),dateadd(month,datediff(month,0,getdate()),17)MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-15 : 10:50:34
|
MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|