17,140
社区成员




-- 每天的
with m as (
select row_number() over(partition by to_char(realtime,'yyyy-mm-dd') order by realtime) rn, t.*
from T_DATA_WY t
)
select * from m where rn = 1
-- 每月的
with m as (
select row_number() over(partition by to_char(realtime,'yyyy-mm') order by realtime) rn, t.*
from T_DATA_WY t
)
select * from m where rn = 1
-- 每年的
with m as (
select row_number() over(partition by to_char(realtime,'yyyy') order by realtime) rn, t.*
from T_DATA_WY t
)
select * from m where rn = 1
-- 这个是你的表名称
with m as (
select row_number() over(partition by trunc(realtime) order by realtime) rn, t.*
from T_DATA_WY t
)
select * from m where rn = 1