任何人都可以向我解释为什么我会收到这个错误,我错了,以后要做些什么来避免它。
SELECT a.*, row_number() over (partition by code_employee order by
to_date(substr(last_located_time,1,10),'yyyy-mm-dd')) rn
FROM
(SELECT LAST_LOCATED_TIME, NAME_COMMON, CODE_EMPLOYEE
FROM
daily_report
WHERE INSERT_DATE = TRUNC (SYSDATE-3) AND DEVICE_NAME LIKE '%SM-T116IR')a
WHERE rn=1;
答案 0 :(得分:1)
请尝试这个:
select *
from (select a.*,
row_number() over(order by to_date(last_located_time, 'dd.mm.rrrr')) rn
from (select last_located_time, name_common, code_employee
from daily_report
where insert_date = trunc(sysdate-3) and device_name like '%SM-T116IR') a)
where rn = 1