Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

linq query to fetch parent child data from same table in c#

var v = from p in db.tableName
        select new
        {
          ParentID = p.SerialNo,
          child = from c in db.tableName
                  where c.Parent == p.SerialNo select
                  new
                  {
                    ChildID = c.SerialNo,
                    ParentID = c.Parent
                  }
        };
Comment

PREVIOUS NEXT
Code Example
Csharp :: pass viewbag selectlistitem to razor 
Csharp :: setxkbmap 
Csharp :: C# HttpUtility not found / missing C# 
Csharp :: deleting an item from a vector c# 
Csharp :: Max upload size for ASP.MVC CORE website 
Csharp :: DisplayUnitType revit api 
Csharp :: how to make a beep in c# 
Csharp :: how to refresh the data table in C# window form datagridview 
Csharp :: ASP.NET C# Catch all exceptions in a class 
Csharp :: how to combine constructors in c# 
Csharp :: save string to file c# 
Csharp :: Handlebars c# datetime now 
Csharp :: serach a keyword in whole database 
Csharp :: Razor break/continue in loop 
Csharp :: to string c# fields 
Csharp :: c# logical operators 
Csharp :: class merging 
Csharp :: asp.net core get current culture in controller 
Csharp :: get path c# application 
Csharp :: SendFileAsync discord 
Csharp :: == vs equals c# 
Csharp :: generate jwt token authorize(roles = admin ) not working .net core 403 
Csharp :: unrecognized escape sequence c# connection string 
Csharp :: LINQ return list of unique values with counts 
Csharp :: object escape player unity 
Csharp :: Rotate Object/Camera by Mouse 
Csharp :: c# order by descending on 2 values 
Csharp :: C# walk down a tree and back 
Csharp :: c# default parameter 
Csharp :: c# webrtc dll 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =