How can I get the 7 dates of the previous week from a date,
For example:
Today's date: 01/08/2019 belongs to the 2nd week.
In this case the result would be 7 dates of the 1st week. (From 12/31/2018 to 01/06/2019)
How can I get the 7 dates of the previous week from a date,
For example:
Today's date: 01/08/2019 belongs to the 2nd week.
In this case the result would be 7 dates of the 1st week. (From 12/31/2018 to 01/06/2019)
Oracle is not my strong point, but you can do it by first subtracting 7 days from the current date and then getting the week number of that new date.
This is how you can subtract days from a date:
https://stackoverflow.com/questions/27451226/add-days-oracle-sql
Credit to @mkumawat10's answer and translation for in this case 7 days less:
And so get the number of a week:
https://stackoverflow.com/questions/16530044/how-to-extract-week-number-in-sql
Credit to @Wolf's answer and translation for the current situation:
In this last case 'IW' can be replaced according to the options to consider:
You can do something like this:
Departure:
Detail:
sysdate
in this example, we obtain the first day of the week, we subtract 1 day, to go to the previous week and we recalculate the first day of the week.dual
we generate a sequence of 7 values that we combine with the obtained date to generate the 7 days of the current week.