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 |
kishoremcp
Starting Member
41 Posts |
Posted - 2013-09-10 : 05:07:23
|
Hi, I am new to sql server. I want a sql query to get previous year's previous months first day everytime. Example: If i run the query on 9/10/2013 (MM/DD/YYYY) then it should give 8/1/2012. Please let me know how..Also help me with any documentations to know about queries. Any PDF files kind of thing. Thanks in advance.RegardsKishore |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-09-10 : 09:08:59
|
[code]DATEADD(mm,DATEDIFF(mm,0,GETDATE())-13,0)[/code] |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-09-10 : 09:20:02
|
Dup of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=188086 |
|
|
|
|
|