suppose that we have a table called table1 in Sql server with te following structure and data:
TableName: Parts
PartCode PartName
-------------------
10 Dashboard
11 Mirror
12 Seat
13 Cord
TableName: CarParts
CarCode PartCode
--------------------
01 10
01 11
01 12
02 11
02 12
03 10
03 11
03 13
How can I get CarCode(s) which contain ALL PartCodes I have listed in a data structure like a datagridview in a winform (C#)? I should say that I have written a UDF in Sql server that takes 1 argument (CarCode) and returns a CSV of all PartCodes that are related to it.
EDIT: for example my PartCode list has 2 PartCodes: 10, 12 The query should return CarCode(s) that contain both 10 and 12 and it's only CarCode "01" not the others. I hope this clarifies what I mean.