Skip to content
Advertisement

How to get the current month and previous months for the previous year

I have requirements to get the current month of the year and the last year’s month. Something like this: enter image description here

Right now what I did is hard code it like this:

Is it possible to do it dynamically instead of doing hard coded?

Advertisement

Answer

Please find below the answer on the MSSQL server as per your requirement.

enter image description here

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement