Need help to get all monday's for the date

  1. jagadekara

    jagadekara Forum Guru

    Messages:
    1,179
    Likes Received:
    148
    Trophy Points:
    1,805
    Location:
    Pulivendula
    Hi All,
    I am trying to get All the Monday's for the Dates.
    Ex:
    If we Pass 01-Aug-2020 to 12-Aug-2020 then it should display
    31st Jul 2020 (Monday)
    then 3rd aug and 10th aug

    If we pass start date saturday's date then it should display taht week's monday , same way for end date . And also it should display All Monday's between these 2 dates.

    As of Now I tried below query, but that is working for one Promotion_id. If I comment Promotion_id condition then not working.

    select * from
    (select cph1.promotion_id,trunc(cph1.start_date,'Day') -1 + rownum as d
    from all_objects ao,ctp_promotion_headers cph1
    where trunc(cph1.start_date,'Day') -1 +rownum <= cph1.end_date
    --and cph1.promotion_id in (nvl:)P_PROMOTION_CODE,cph1.promotion_id))
    --and cph1.promotion_id in (39) --(38,39)
    ) allDates
    WHERE trunc(allDates.d,'Day')+1 =allDates.d

    Thanks,
    Jagadekar