34,587
社区成员
发帖
与我相关
我的任务
分享
select a.Rdt,a.kc_ep,a.Kid from KC_EP a,tb_order b
where not exists(select 1 from KC_EP where datediff(dd,a.Rdt,Rdt)=0 and Rdt<a.Rdt)
order by a.Rdt,b.Sid
select * from (
select *,ROW_NUMBER() over(partition by convert(char(10),dt,120) order by dt ) as rn
from tb ) a
where rn=1
select *
from tb b
where not exists(select 1 from tb where datediff(d,b.dt,dt) = 0 and dt < b.dt)
select
*
from
tb t
where
f1=(select max(f1) from tb where dt=t.dt)
and
month(dt)='xx'