select *
from 表 a join (select 物品, max(日期) as 日期 from 表 group by 物品) b
where a.物品 = b.物品 and a.日期 = b.日期
from 表 a join (select 物品, max(日期) as 日期 from 表 group by 物品) b
where a.物品 = b.物品 and a.日期 = b.日期
调试欢乐多
from #table a join (select 物品, max(日期) as 日期 from #table group by 物品) b
on a.物品 = b.物品 and a.日期 = b.日期
order by a.物品
from 表 a join (select 物品, max(日期) as 日期 from 表 group by 物品) b
on a.物品 = b.物品 and a.日期 = b.日期或者
select *
from 表 a ,(select 物品, max(日期) as 日期 from 表 group by 物品) b
where a.物品 = b.物品 and a.日期 = b.日期
你的意思好像是这样的:
select top 1 * from table group by 物品 order by 日期 desc是不是?
where 日期 in
(select max(日期) from table6
group by 物品)