Advertisement

05.22.2008 at 10:25AM PDT, ID: 23425224
[x]
Attachment Details

Converting Embeded Aggregate Queries to Linq

Asked by GMSDev in Language Integrated Query - LINQ, MS SQL Server, .NET

Tags: Linq

Can anyone help me convert this to LINQ.  I am hung up on how to conver the aggregate queries in the return set.

ThanksStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
SELECT
	*,			
	LOE = (SELECT Sum(Task_LOE) FROM Tasks WHERE (Tasks.Project_ID = Projects.Project_ID)),
	Actual = (SELECT Sum(Hours) FROM Hours, Tasks WHERE (Hours.Task_ID = Tasks.Task_ID) AND (Tasks.Project_ID = Projects.Project_ID))
FROM 
	Projects,
	Clients,
	Project_Types
WHERE
	Projects.Client_ID = Clients.Client_ID AND
	Projects.Project_Type_ID = Project_Types.Project_Type_ID AND
	Project_ID IN (
		SELECT
			Project_ID
		FROM
			Tasks
		WHERE
			Tasks.Task_Assigned_To_ID = @User_ID
	)
ORDER BY 
	Projects.Project_ID
[+][-]05.22.2008 at 10:33AM PDT, ID: 21625854

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Language Integrated Query - LINQ, MS SQL Server, .NET
Tags: Linq
Sign Up Now!
Solution Provided By: dbaSQL
Participating Experts: 2
Solution Grade: B
 
 
[+][-]05.22.2008 at 10:33AM PDT, ID: 21625860

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.22.2008 at 01:36PM PDT, ID: 21627342

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.22.2008 at 04:14PM PDT, ID: 21628374

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628