score:1
Accepted answer
This should work.
var query = from stk in V_InStock
group stk by stk.PartNo into stkg
where stkg.Key == '100-25897'
select new
{
ModulePartNo = stkg.Key,
Available = stkg.Sum(s => s.Delivered) - stkg.Sum(s => s.Allocated)
}
score:0
If you need to do aggregate grouping etc you will probably need to set up an object to "select" everything into. However for a straight join something like this should work.
var outputObject = (from t1 in dbContext.table1
join t2 in dbContext.table2 on t1.PartNo equals t2.PartNo
select (t1.Delivered - t2.Allocated));
Source: stackoverflow.com
Related Articles
- Linq issue select Sum of one column minus another from different table
- Which LINQ query to select rows from 1 table that are not in another table
- How to select column from child table in linq
- LINQ select from table where fieldValue is in another tables list of values
- LINQ to SQL join two tables to select parent table twice based on two different columns from child table
- Select values from one table based on specific value of another table Linq
- LINQ error to select a column from the table
- LINQ query to conditionally filter on a where clause and select the values from another table
- Select a table column from IEnumerable using Linq
- LINQ conditional select from table and return multiple column as a single list
- Linq to query matching column from a table and populate in another table
- select data from first table based on two forigen key in another table using linq
- select multiple column from include table in LINQ
- How to select only those records from collection which have relation with another table using Linq
- LINQ Group results and select from another table
- Grab a FK's string value from different Table during Select with linq in C#
- Select single column from dataset with LINQ
- Linq - How to select items from a list that contains only items of another list?
- Exclude a column from a select using LINQ
- Linq to select data from one table not in other table
- Linq on DataTable: select specific column into datatable, not whole table
- LINQ select List where sub-list contains item from another list
- Creating a LINQ Select expression dynamically from string column names
- Linq select Item where it is equal to ID in another table
- How to include one specific row from another table with LINQ to Entities
- Select items from a List where the children contain the items from another List using LINQ
- linq how to select the parent from a collection where the parent contains child items in another collection
- Eliminate comma(,) from a column of a Data Table using LINQ
- LINQ to select a column with max date from a group
- Linq from TABLE select *
- Filter a string array from string array in an object
- IQueryable for entities .Where( property is in local array)
- how to write LINQ to objects equivalent code for this code
- What is the structure of IQueryable?
- WP7 Getting and storing data from an xml web service for use across the project
- Issue with building multiselect user control
- How to find out a child's parent?
- Accessing Specific Properties Inside IEnumerable
- LINQ Order by column x and if empty take column y
- GroupBy of List<double> with tolerance doesn't work
- Using LINQ to exclude a Child Node from a collection of the same name
- How to create a non-nullable CRM basic type like int or double?
- Comparing array of objects in Powershell
- Linq query to Parse XML
- Don't add NULL data to the list
- How to get 2 columns from datatable in linq
- How do I get all the children of a table without knowing their type, returned to a list?
- sum and group by in linq to sql
- Oracle query to LINQ
- how to compare 2 XML using LINQ in C#