Im trying to get the total of a field in a database using the sql - SUM(Timespent) as Totaltimespent, Timespent is the name of the column with the numbers i want to add up.
My code below doesnt work
I'm using MS SQL
SELECT tblClient.[name] as ClientName , tblProject.[Name] as ProjectName , tblEmployee.[Name] as EmployeeName , Date ,Timespent ,SUM(Timespent) as Totaltimespent, Task ,EmployeeID,tblTimesheet.ID as ID FROM tblTimesheet INNER JOIN tblProject on tblTimesheet.ProjectID = tblProject.ID INNER JOIN tblEmployee on tblTimesheet.EmployeeID = tblEmployee.ID INNER JOIN tblClient on tblProject.ClientID = tblClient.ID
WHERE ProjectID=@ProjectID AND tblProject.ClientID =@ClientID