I need to use the following SQL query in LINQ, but despite my best efforts, I am unable to make it work.
This is the SQL command:
SELECT ST.Description, ST.STId, COUNT(SI.SIId) AS Expr1
FROM BP INNER JOIN
MbrBP ON BP.BPId = MbrBP.BPId INNER JOIN
SI ON BP.BPId = SI.BPId RIGHT OUTER JOIN
ST ON SI.STId = ST.STId
WHERE (BP.CountryId = 1) AND (BP.RegionId = 1) AND (MbrBP.MemberId = 1)
AND (SI.IsActive = 1)
GROUP BY ST.Description, ST.STId
UNION
SELECT ST.Description, ST.STId, COUNT(SI.STId) AS Expr1
FROM SI RIGHT OUTER JOIN
ST ON SI.STId = ST.STId
GROUP BY ST.Description, ST.STId
Can someone please help me with this?