Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi -

I'm looking to rewrite this query in linq and literally have no idea. In my application I have strongly typed view models so dont know if using annomous types as a few of the articles have stated.

Here is the sql :

SQL
select 
	o.ReplacementItemID,
	o.ItemStatus,
	o.Description,
	i.ItemWarrantyID,
	o.Id as OriginalItemId
from
	(
		select 
			id,
			ItemStatus,
			Description,
			ItemWarrantyID,
			ReplacementItemID
		from item
		where ItemStatus = 'obso'	
	)o
	inner join Item i	
	on o.ReplacementItemID = i.Id
	--where o.ReplacementItemID = 948032


What I have tried:

http://linq101.nilzorblog.com/linq101-lambda.php
Posted
Updated 15-Jul-16 11:03am

1 solution

var queryNestedGroups =
from student in students
group student by student.Year into newGroup1
from newGroup2 in
(from student in newGroup1
group student by student.LastName)
group newGroup2 by newGroup1.Key;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900