I'm looking to get distinct rows with a start and end date from a table with structure below. I dont want duplicate rows with same start and end month. Please note that start and end date are NUMBER type here, not date.
tbl_app_ranges:
rg_id start_month end_month
105 200401 200409
105 200401 200409
110 200701 200712
110 200701 200710
What I want is the below result set
rg_id start_month end_month
105 200401 200409
110 200701 200712
110 200701 200710
I know this can be done with analytics but not sure how. Is there a way to do this in pure SQL? I need the query to work against Oracle database.
DISTINCT/UNIQUEor aGROUP BY rg_id, start_month, end_month.