I'd like to create a LINQ query that returns the sum of all quantities for a given productnumber for a parent account and all it's child accounts.
I have a table of products by account number in which each row also contains a qty and the parent account number:
PartNumber AccountNumber ParentAccountNumber Qty
---------- ------------- ------------------- ---
1000000390 27113 27173 2
1000000390 27516 27173 1
1000000390 00113 27173 0
1000000390 27748 27173 5
SELECT * FROM Inventory
WHERE ProductNumber='1000000390'
AND ParentAccountNumber=(SELECT TOP 1 parentaccountnumber FROM Inventory
WHERE accountnumber='27748')
is this possible in pure LINQ syntax? Do I need to use extension method syntax instead?
Thanks, -Keith