Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LINQ expression
- var allSchools =
- Context.Schools.
- Include("District.State").
- Where(s => s.Nces == "" || s.Nces == null).ToList();
- -- result
- SELECT
- [Extent1].[id] AS [id],
- [Extent1].[nces] AS [nces],
- [Extent1].[name] AS [name],
- [Extent1].[district_id] AS [district_id],
- [Extent2].[id] AS [id1],
- [Extent2].[name] AS [name1],
- [Extent2].[state_id] AS [state_id],
- [Extent3].[fips] AS [fips],
- [Extent3].[abbr] AS [abbr],
- [Extent3].[name] AS [name2]
- FROM
- [dbo].[Schools] AS [Extent1]
- LEFT OUTER JOIN [dbo].[Districts] AS [Extent2]
- ON [Extent1].[district_id] = [Extent2].[id]
- LEFT OUTER JOIN [dbo].[States] AS [Extent3]
- ON [Extent2].[state_id] = [Extent3].[fips]
- WHERE
- [Extent1].[nces] = N''
- OR [Extent1].[nces] IS NULL
Advertisement
Add Comment
Please, Sign In to add comment