
select * from Goods where ID in (select max(ID) from Goodst group by SpecID)

本文介绍了一种使用SQL查询特定商品信息的技巧,通过子查询和聚合函数结合的方式,实现了从商品表中筛选出每个规格下ID最大的商品记录。

select * from Goods where ID in (select max(ID) from Goodst group by SpecID)


被折叠的 条评论
为什么被折叠?