22,207
社区成员
发帖
与我相关
我的任务
分享
select * from tb a
where not exists(select 1 from tb
where convert(10,AddDate,120)=convert(10,a.AddDate,120) and AddDate>a.AddDate)
select convert(varchar(10),AddDate),ProductID,
replace(max(convert(nvarchar(19),AddDate)+convert(nvarchar(16),Price)),
max(convert(nvarchar(19),AddDate)),'') as Price
group by convert(varchar(10),AddDate),ProductID
select * from 表 a
where not exists(select 1 from 表 where 产品=a.产品
and convert(varchar(10),AddDate,120)=convert(varchar(10),a.AddDate,120)
and AddDate>a.AddDate
select *
from tb t
where not exists (select 1 from tb where ProductID = t.ProductID
and convert(varchar(8),adddate,112) = convert(varchar(8),t.adddate,112)
and adddate > t.adddate)