Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in SQL by (6.1k points)

I am having the following SQL query and I want to have it in LINQ, I tried many things but I can't get it working.

Below is my SQL query.

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  

1 Answer

0 votes
by (12.7k points)

You can try Linqer. It is an SQL-> LINQ converter. 

Or you can also try the LINQPad.

Using these sites, you can convert SQL->Linq.

Looking for SQL Tutorial? Sign up for the SQL Certification course to gain more knowledge on SQL.

Related questions

0 votes
1 answer
0 votes
4 answers
0 votes
1 answer
asked Dec 5, 2020 in SQL by Appu (6.1k points)
0 votes
0 answers
asked Dec 29, 2020 in SQL by biscottob (120 points)
0 votes
1 answer

Browse Categories

...