title: Simple SQL Server table LINQ learning query
body: <p>Preamble:</p>
  
  <p>I'm trying to learn C#/LINQ by creating a new application from an existing program. Essentially, I'm porting SQL stored procedures to C#/LINQ code with a new database and slightly different functionality. Although I've had assistance with getting going I've ran into my first what some might say trivial problem.</p>
  
  <p>Although any correct answer would be very much appreciated so would direction. (e.g. is it just a query with simply a Group Into clause? have I missed a similar question in stackoverflow? I have lots of learning tools at my disposal thanks to browsing stackoverflow for a number of months, <a href="http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b" rel="nofollow">101 LINQ Samples</a>, C# In Depth, C# 4.0 in a Nutshell and <a href="http://www.linqpad.net/" rel="nofollow">LINQPad</a>. The information is great, it's just that I'm a bit overwhelmed by it.</p>
  
  <p>Question:</p>
  
  <p>I have the following table:</p>
  
  <pre><code>CREATE TABLE [dbo].[User]
  ([Id] [nvarchar](255) NOT NULL,
   [Name] [nvarchar](max) NOT NULL,
   [LineManagerId] [nvarchar](255) NULL,
   [Email] [nvarchar](max) NOT NULL,
   [IsAdmin] [bit] NULL,
  )
  </code></pre>
  
  <p>The primary key is <code>Id</code>, the <code>LineManagerId</code> is a foreign key of <code>Id</code>.</p>
  
  <p>I would like to would like to write LINQ code to query the database to find if an <code>Id</code> is a <code>LineManagerId</code> AND if so select all the Ids that that <code>LineMangerId</code> has?</p>
  
  <p>I've had an attempt as follows but am missing some what I reckon are very basic skills in my understanding of LINQ.</p>
  
  <pre><code>var ismanager = from manager in Users
                  join man in Users on manager.Id equals man.LineManagerId
                  select man.LineManagerId;   
  </code></pre>
  
  <p>Thanks for reading.</p>