Dateadd is a handy command to add or subtract the days/month/year in a specified date column.
The syntax is Dateadd(type,datecolumn)
type may be dd or mm or yy
Below is the query to get the current date:
select getdate()
I need the previous month (Same day). Then, the query should be modified as,
select dateadd(mm,-1,getdate()) -- dateadd(yy,1,getdate())
If I need to retrieve next year with same day and sae month. Then,
select dateadd(yy,1,getdate())
