var query = from a
in
db.ONExport
let ExportType = (from b
db.ONExportFlag
where b.nOnFlagID == 13
select b.sFlagValue).SingleOrDefault()
let MultipleFileOutput = (from c
where b.nOnFlagID == 21
select
new
{
a.nONExportID,
a.nExportDescription,
a.sOutputFileName,
ExportType,
MultipleFileOutput
};
Hello,
LINQ QUery
from p in db.Purchases
where p.Customer.Address.State == "WA" || p.Customer == null
where p.PurchaseItems.Sum (pi => pi.SaleAmount) > 1000
select p
Compare this to the SQL equivalent:
SELECT p.*
FROM Purchase p
LEFT OUTER JOIN
Customer c INNER JOIN Address a ON c.AddressID = a.ID
ON p.CustomerID = c.ID
WHERE
(a.State = 'WA' || p.CustomerID IS NULL)
AND p.ID in
(
SELECT PurchaseID FROM PurchaseItem
GROUP BY PurchaseID HAVING SUM (SaleAmount) > 1000
)
Hope this helpful!
Thanks
query.Any(x => predicate)
is equivalent to the SQL
EXISTS(SELECT * FROM query WHERE predicate )
Regards,