Reputation: 509
I have this code in Linq. Anybody can provide the t-sql. thanks!
var tsr = from t in db.Tngs
from l in t.TngUsr
from td in t.TngDepts
from u in db.Users
where t.TId == tId && u.UserId == l.UserId && u.Departments.DeptId == td.Departments.DeptId
is the second/third from left outer?
Upvotes: 1
Views: 154
Reputation: 2544
Try to run that in LinqPad. It would display the T-SQL equivalent of your linq code. It would even convert that linq expression into the equivalent Lambda expression.
Upvotes: 7
Reputation: 180777
It looks like it's something like this:
SELECT t, l, td, u
FROM Tngs
JOIN TngUser ON TngUser.UserID = Users.UserID
JOIN Users ON Users.UserID = TngUser.UserID
JOIN Departments ON DepartmentID = tngDepartmentID
WHERE Tngs.TId = tId
Upvotes: 1