How can i get last there previous month names by useing system date
Printable View
How can i get last there previous month names by useing system date
Select to_char(add_months(sysdate,-rownum),'month') prev_months from user_tables where rownum<=3;
[QUOTE=krishnaindia2007;28424]Select to_char(add_months(sysdate,-rownum),'month') prev_months from user_tables where rownum<=3;[/QUOTE]
Will that work in SQL server ?
[QUOTE=debasisdas;28451]Will that work in SQL server ?[/QUOTE]
Sorry. I answered the question without observing forum.
I got the answer for question
select datename(month, dateadd("month",-1,getdate())), datename(month, dateadd("month",-2,getdate())),
datename(month, dateadd("month",-3,getdate()))
Sorry boreddy u cant use month is quotes.
Use
select datename(month, dateadd(month,-1,getdate())), datename(month,
dateadd(month,-2,getdate())),datename(month, dateadd(month,-3,getdate()))