SQL Language (MOSC)

MOSC Banner

SQL Query to get Maximum date with in each month

Hi All. I am looking for sql query to get the maximum date with in each month. sample data below

with sample_data as (

                    select 1 id,to_date(20200401,'yyyymmdd') process_date, to_date(20200425,'yyyymmdd') end_date from dual union all

                    select 1 id,to_date(20200426,'yyyymmdd') process_date, to_date(20221231,'yyyymmdd') end_date from dual union all

               select 2 id,to_date(20200401,'yyyymmdd') process_date, to_date(20200425,'yyyymmdd') end_date from dual union all

                    select 2 id,to_date(20200426,'yyyymmdd') process_date, to_date(20221231,'yyyymmdd') end_date from dual union all

                    select 3 id,to_date(20190929,'yyyymmdd') process_date, to_date(20210313,'yyyymmdd') end_date from dual union all

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center