score:3
Accepted answer
if you need all rows from first table whether or not they can be joined to rows from second table, you need a left join:
var results = from table1 in table.asenumerable()
join table2 in comment.asenumerable()
on table1.field<string>("kundename") equals table2.field<string>("kundename") into joined
from table3 in joined.defaultifempty()
select new
{
kundeid = table1.field<int32?>("kundeid"),
kundename = table1.field<string>("kundename"),
produkt = table1.field<string>("produkt"),
comment = table3 != null ? table3.field<string>("comment") : null
};
this way you can get client named "miky" but the comment
for him is going to be null.
score:0
your o4
object doesn't have an object in comment
that has a matching kundename
value, so it is not included in the results.
perhaps you did not mean to use an inner join?
Source: stackoverflow.com
Related Query
- How to perform Join between multiple tables in LINQ lambda
- LINQ to SQL multiple tables left outer join
- Select All columns for all tables in join + linq join
- How to join tables in EF LINQ
- How to join 3 tables with linq
- How to left join multiple tables with LINQ
- Join tables in SQLite.Net with LINQ on xamarin.android is not supported
- Multiple tables left join using Linq
- linq query to join two tables and get the count from one table values from the other
- Left outer join using LINQ -- understanding the code
- How to reuse a linq expression for 'Where' when using multiple source tables
- LINQ Source Code Available
- LINQ to SQL and Join two tables with OR clause
- using linq with join using two where on two tables
- linq join 3 tables with or condition
- LINQ to Entities, join two tables, then group and take sums of columns from both tables
- C# + LINQ + ADO.NET EF , join 2 tables and return everything without specifying all fields manually
- LINQ to SQL join 3 tables and select multiple columns and also using Sum
- How can I code an outer join using LINQ and EF6?
- LINQ Join through 3 tables to Sum one column
- Linq Join across three tables
- C# Linq Join 2 tables on multiple columns and GROUP BY for count
- Problem with simple join by multiple columns in two tables using linq
- ASP.NET MVC application users linq to join to other tables
- creating Linq to sqlite dbml from DbLinq source code
- LINQ Query To Join Two Tables and Select Most Recent Records from Table B corresponding to Table A
- How to use Linq to join entity tables with a cross-reference table
- Entity Framework: How to perform left join with EF and LINQ among multiple tables
- LINQ Inner Join - Return From Both Tables
- Linq join two tables and count column
More Query from same tag
- Sort part of a list in descending order (by date), the other part in ascending order (alphabetically)?
- C# why is duplicating object record when persist?
- Windows Phone SQL Server CE - Retrieve underlying database schema for upgrade
- How to read a sitemap using VB.NET
- LINQ: Cannot insert duplicate key row in object 'dbo.tblOutstandingCompletions' with unique index
- IEnumerable<dynamic> with linq
- Search Keywords using LINQ
- removing fields with numbers in linq to entity query
- Showing Unable to create a constant value of type ''. Only primitive types ('such as Int32, String, and Guid') are supported in this context
- Linq Group selection
- How to group a list of lists by date using Linq?
- How to get top 5 products with highest views?
- Looping over ILookup, accessing values
- Linq equivalent to SQL LIKE [a-f]
- C# collection indexed by property?
- Sorting and filtering a list of custom object dynamically in vb.net
- Telerik Linq Extremly Slow When Using Query with OrderBy
- How to save DataGridView to XML using Linq without dataset
- LINQ Equivalent of SQL
- Return data from inner join without creating new object
- Help creating an instance of a class using Linq and XML
- How to get text from LINQ2SQL query?
- Cannot check the same property twice using dynamic linq
- Combining two LINQ queries into one
- What is the correct way of reading single line of data by using Linq to SQL?
- Linq Query to Group By Multiple Columns But Get Additional Properties
- How to use let to define a new set of data within a LINQ query?
- The data source does not support server-side data paging
- How to get the IndexOf() blank space in Linq Query
- Sum in Linq to Object query vb.net