Skip to content
Advertisement

SQL Query to display dates weekly from current date

I have a requirement to display dates every week starting from current date for 48 months.

I was wondering if it is possible through SQL or i will have to write a function to achieve it.

Below is my SQL so far :-

This would give me output as

Expected Output :-

Advertisement

Answer

If I understand correctly:

This uses the mod() operation on the date difference. You can also check the day of the week:

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