score:0
var result = (from a in db.table_1
from b in db.table_2
where a.id == b.id
&& db.state.any(c=>c.regionid == 1 && b.stateid == c.stateid)
select new
{
a.id
}).tolist();
score:0
where db.states.any(x => x.regionid == 1 && x.stateid == b.stateid)
select...
score:0
var var1 = (from a in db.table_1
join b in db.table_2
on a.id equals b.id
where db.state.any(c=> c.regionid == 1 && c.stateid == b.stateid)
select new
{
a.id
}).tolist();)
score:0
var var1 = (from a in db.table_1
join b in db.table_2
on a.id equals b.id
where (db.state.where(x => x.regionid == 1).select(x =>
x.stateid)).contains(b.id)
select new
{
a.id
}).tolist();)
Source: stackoverflow.com
Related Query
- Including values from external table in a LINQ statement
- Linq equivalent of sql statement from one table but including counts based on groups within that table
- linq query to join two tables and get the count from one table values from the other
- LINQ select from table where fieldValue is in another tables list of values
- asp.net mvc Linq exclude values from other table
- How to return values from a LINQ query and display them in a table using C#, ASP.NET MVC and Entity Framework
- Check a value from a second table within a LINQ Statement
- LINQ statement getting value from one table depending on the other table
- LINQ retrieve values from a table that of which fields(of a certain column) are not equal of another table
- Linq group by multiple columns and getting extra values from table before group by clause
- Linq query selects values from first row only in table
- Select values from one table based on specific value of another table Linq
- LINQ - I need to pull records from table 2 based on values in table 1
- Returning multiple values from a Group by LINQ statement C#
- LINQ to SQL to find values starting with characters from another table
- LINQ query for grouping a table based on the values from another table
- Get columns values in data table using linq from Entity Framework
- Returning an object of values from grouped LINQ statement
- Linq assign values from one table into another
- LINQ query to conditionally filter on a where clause and select the values from another table
- LINQ: join multiple Table Column using Linq and find aggregated sum from child table values
- Getting table values plus count of some columns in the same linq statement
- selecting a column values from a Table using LINQ (Entity Framework)
- How to get values of table from another table in LINQ
- SQL to LINQ - left join from same table using values equal to and greater than
- EF LINQ to SQL is getting whole table from DB instead of selection - where clause contains list with Any statement
- Linq return distinct values from table if not exist in another
- LINQ query to return distinct field values from list of objects
- How to select values within a provided index range from a List using LINQ
- How to select multiple values from a Dictionary using Linq as simple as possible
More Query from same tag
- Mongodb c# driver: view MQL bson query generated from linq
- Can't reference variable from anonymous type
- LINQ to Entities not recognizing method
- Sort or Order a List of strings containing a specific word with LINQ
- LINQ query is null
- How to get records affected by an update stored procedure in LINQ to SQL
- In LINQ how to use column value passed to IQueryable function with func<T,T2>
- LINQ Query over another LINQ query
- EF linq/lambda .contains(list[String])?
- LINQ to SQL, select targets with max date
- LINQ with Sub Query, Group By, and Having
- Can't use custom extension methods with IronPython
- Powershell Equivalent of Linq Statement
- LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method
- linq nested entities and collection
- How to sort a list of strings with a specific format using string.split?
- How do I Sort/OrderBy IList<Int32>
- Check C# MVC Linq If a stored date is 7 days away
- IEnumerator for HashTable?
- EF - "Update-Database" causing Sequence contains more than one element
- List<> Get next or previous element that satisfys a condition
- Linq - How to prevent locks when bulk delete
- Linq many to many select query with Distinct
- How can I efficiently link two datasets in C#?
- Having trouble Aggregating over a list of expressions with Expression.AndAlso
- Can I write case when query in entity framework core and linq?
- How to Merge two sub list with linq
- How to filter nested entities of the same type?
- How to use EXISTS in where condition of LINQ?
- A query body must end with a select clause or a group clause on core method