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:
我的查询带来了下面的Oracle表:
select * from PPLP_LOAD_GENSTAT order by 2 desc
This outputs:
这输出:
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?
例如,我想删除PPL_IMPORT_CALLHOSTED_ESTIMATES双记录并保留一个记录。等等其他重复记录。如何执行通用查询以删除重复并仅将一行保留为原始行?
How would that be possible?
怎么可能呢?
2 个解决方案
#1
2
Assuming you want the broadest parameters, minimum start time and maximum end time then use a combination of MIN
, MAX
and GROUP BY
假设您需要最广泛的参数,最小开始时间和最大结束时间,则使用MIN,MAX和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
#2
1
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
#1
2
Assuming you want the broadest parameters, minimum start time and maximum end time then use a combination of MIN
, MAX
and GROUP BY
假设您需要最广泛的参数,最小开始时间和最大结束时间,则使用MIN,MAX和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
#2
1
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