SELECT A.* FROM A INNER JOIN (
select max(时间) as 时间,ProductSN from A group by ProductSN) B ON A.ProductSN =B.ProductSN AND A.时间=B.时间
select max(时间) as 时间,ProductSN,状态,排序 from 表 group by ProductSN,状态,排序
你既然做了排序,那就分组加降序排序,然后筛选序号为1的不就行了吗