1

I have made a table containing with data that i depict to a dashboard.

Well, there should exist for each month only one record.

My query brings the below Oracle table:

select * from PPLP_LOAD_GENSTAT order by 2 desc

This outputs:

enter image description here

For example, i want to remove PPL_IMPORT_CALLHOSTED_ESTIMATES double record and keep only one. And so on for other duplicate records. How can a generic query be executed to remove duplications and keep only one row as original?

How would that be possible?

Matt
  • 14,906
  • 27
  • 99
  • 149
tln_jupiter
  • 153
  • 2
  • 8
  • There not duplicates, they have different start and end times, explain what logic you want to implement to reduce the name field to 1, e.g. max time, min time etc – Matt Sep 14 '17 at 09:59
  • its irrelevant the exactly details in time (seconds) I just want to keep *one* of them :) could you please provide a helpful reply? – tln_jupiter Sep 14 '17 at 10:18
  • Duplicate of https://stackoverflow.com/questions/46221866/oracle-delete-duplicates-records/46232665#46232665 – Ucello Sep 15 '17 at 07:04

2 Answers2

2

Assuming you want the broadest parameters, minimum start time and maximum end time then use a combination of MIN, MAX and GROUP BY

SELECT PPLP_NAME, MIN(START_TIME) AS START_TIME, MAX(END_TIME) AS END_TIME, ROWS_LOADED
FROM PPLP_LOAD_GENSTAT 
GROUP BY PPLP_NAME, ROWS_LOADED
Matt
  • 14,906
  • 27
  • 99
  • 149
0

based on your comment 'its irrelevant the exactly details in time (seconds) I just want to keep one of them'

You can proceed like this:

SELECT DISTINCT PPLP_NAME, TO_CHAR(START_TIME, 'DD/MM/YYYY HH24:MI'), TO_CHAR(END_TIME, 'DD/MM/YYYY HH24:MI'), ROWS_LOADED
FROM PPLP_LOAD_GENSTAT