知道如何将其转换为 linq 吗?
SELECT DISTINCT PartNumber AS [PartNumber That Includes EVERY ItemNumber Listed in @RequiredItemsTable]
FROM Part.BillsOfMaterialsFlattened AS bom1
WHERE NOT EXISTS
(SELECT *
FROM @RequiredItemsTable w
WHERE NOT EXISTS
(SELECT *
FROM Part.BillsOfMaterialsFlattened AS bom2
WHERE (bom1.PartNumber = bom2.PartNumber)
AND (bom2.ItemNumber = w.ItemNumber)));
我在这个网站上看到了几个例子,试图模仿它们......但到目前为止还没有到达那里。
谢谢!
这是我希望通过 linq 实现的表格示例。前面的 T-SQL 可以解决问题。
Part.BillsOfMaterialsFlattened
PartNumber ItemNumber
10041047 10034480
10041047 10041090
10041047 10041091
10041048 10034480
10041048 10041091
10041049 10034650
10041049 10041090
10041049 10041091
10041050 10034650
10041050 10041091
10041061 10001331
10041061 10001422
@RequiredItemsTable
ItemNumber
10041090
10041091
想要生成 LINQ 语句IQueryable<String>
PartNumber (Part Numbers that include all Required Item Numbers)
10041047
10041049