且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ms访问,需要获取所有具有不同列的行

更新时间:2023-11-26 22:05:46

如果只需要一个连接器",每个程序集ID排,您可以使用子查询进行过滤.假设 PartRefID 是唯一键:

If you want just one "connector" row per assembly ID, you can filter with a subquery. Assuming that PartRefID is a unique key:

select *
from parts as p
where [PartRefID] = (
    select max(p1.[PartRefID])
    from parts as p1
    where p1.[AssemblyID] = p.[AssemblyID] and p1.[PartDefID] = 2
)