Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8472961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:13:07+00:00 2026-06-10T17:13:07+00:00

This statement won’t compile: query = from g in context.GridViews join f in context.GridViewFavorites

  • 0

This statement won’t compile:

query = from g in context.GridViews 
   join f in context.GridViewFavorites on g.ID equals f.GridViewID into gf
   where g.GridTypeID == id && ( g.IsShared == true || g.RepID == me.clsRep.OID) 
   && f.RepID == me.clsRep.OID
   select g;

The compiler error is this (and it’s underlining the last part of the where clause:

The name ‘f’ does not exist in the current context

It’s logical SQL counterpart would be:

declare @RepID int
declare @GridTypeID int
select @RepID=15, @GridTypeID=5

select g.*,f.*
from
   GridViews g
   left outer join GridViewFavorites f on f.GridViewID = g.ID
where
   g.GridTypeID = @GridTypeID and (g.IsShared = 1 or g.RepID == @RepID) 
   and f.RepID == @RepID

NOTE: per @hdv ‘s good catch the SQL sample should actually be:

select g.*,f.*
from
   GridView g
   left outer join GridViewFavorite f on f.GridViewID = g.ID and f.RepID = @RepID
where
   g.GridTypeID = @GridTypeID and (g.IsShared = 1 or g.RepID = @RepID) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:13:09+00:00Added an answer on June 10, 2026 at 5:13 pm

    It’s the “into” part of your join – once you’ve joined “into” a group, the join variable (f in this case) is out of scope – you’ve got to use gf instead. Alternatively, given that you’re not actually using gf in your query at all, maybe you should just get rid of the into gf part entirely so it’s a normal join instead of a group join.

    However, that won’t give you a left outer join. If you want a left outer join, you might want:

    query = from g in context.GridViews 
       join f in context.GridViewFavorites on g.ID equals f.GridViewID into gf
       from f2 in gf.DefaultIfEmpty()
       where g.GridTypeID == id && (g.IsShared == true || g.RepID == me.clsRep.OID) 
       && (f2 == null || f2.RepID == me.clsRep.OID)
       select g;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this statement, taken from the Pagerank source code: Pattern.compile(\\[.+?\\]); What does the pattern
If I use this statement: $query = select * from Products where category_description='.$search_dept.' ORDER
This statement doesnot work in Entity Framework context.sleep.Where(o=>o.clientDateTime.TimeOfDay>new TimeSpan(18,0,0)).ToList(); Please suggest me a workaround.
We have this statement: (SELECT res_bev.bev_id, property_value.name AS priority FROM res_bev, bev_property, property_value WHERE
I have this linq statement. var sum = from l in list select new
This statement is returning error 00920- invalid relational operator. I am sure it is
this statement will generate a 4 column table: SELECT shipped.badguy AS badguy, shipped.sdate AS
I have this statement in my c program and I want to optimize. By
For some reason this statement is working fine: vms.Where(vm => vm.MessageType == ValidationMessage.EnumValidationMessageType.Warning) But
I need help finishing this statement. It is frustrating that two of the PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.