I'm needing some syntax help with the following query please? I'd like to use an equivalent in the entity framework but I'm unsure of the syntax.
开发者_JS百科Can someone help me format this to work with the entity framework?
Thanks in advance.
Select * from (
SELECT [Member]
,[MemberGroup],
(SELECT [text]
FROM [umbracoNode]where [id] = [Member]) As MemberName,
(SELECT [text]
FROM [umbracoNode]where [id] = [MemberGroup]) As GroupName
FROM [cmsMember2MemberGroup]
) UG
where UG.MemberName is not null
order by UG.MemberName,
UG.GroupName
Try this:
var query =
from x in db.cmsMember2MemberGroup
join y in db.umbracoNode on x.Member equals y.id
let MemberName = y.text
where MemberName != null
join z in db.umbracoNode on x.MemberGroup equals z.id
let GroupName = z.text
orderby new { MemberName, GroupName }
select new
{
x.Member,
x.MemberGroup,
MemberName,
GroupName,
};
Is there a particular reason that this query is in this format?
Why are there not use of joins?
Need to really understand what you want here first and get into better sql before going to linq.
精彩评论