I have a tricky SQL statement to write and not sure if it's even possible
I have the following 3 tables and fields:
tblProjects
projectID
taskID
etc....
tblTasks
taskID
taskName
etc...
tblTiming
timingID
taskID
hoursworked
etc...
tblExpenses
expenseID
taskID
expenseamount
etc...
What I want to do is display the SUM of both hoursworked and expenseamount as ActualCost
I've tried this SQL statment but it doesn't add the 2 summed values together.
Any suggestions
Regards,
Russ
I have the following 3 tables and fields:
tblProjects
projectID
taskID
etc....
tblTasks
taskID
taskName
etc...
tblTiming
timingID
taskID
hoursworked
etc...
tblExpenses
expenseID
taskID
expenseamount
etc...
What I want to do is display the SUM of both hoursworked and expenseamount as ActualCost
I've tried this SQL statment but it doesn't add the 2 summed values together.
Code:
SELECT (SELECT SUM(tblTiming.TotalCost) AS SumCost FROM tblTiming WHERE tblTiming.TaskID=tblTasks.TaskID;) + (SELECT SUM(tblExpenses.Amount) As SumExpense FROM tblExpenses WHERE tblExpenses.TaskID=tblTasks.TaskID;) AS ActualCost
FROM tblTasks
WHERE (((tblTasks.ProjectID)=[@ProjectID]));
Any suggestions
Regards,
Russ