I am trying to write a query that will return the last friday of the previous month but I am running into the issue of trying to use Current_Date along with Last_Date. I need to use SELECT CURRENT_DATE from dual
no matter what. This is what I have so far, any help would be greatly appreciated as I am new to this.
SELECT CURRENT_DATE
FROM DUAL
where (LAST_DAY( SYSDATE ) - INTERVAL '7' DAY,
'Friday' );
考虑:
理由:
trunc(sysdate, 'month')
gives you the first day of the current monthwe offset that value by 8 days so we can the the date 7 days before the end of the previous month
then,
next_day()
returns the next Friday after this date, that is the last Friday of the month