SqlCommand command = new SqlCommand(@"SELECT Workers.Full_Name,Workers.Salary, CASE WHEN (SUM(JobHours.Additional_Time)) > 0 THEN (SUM(JobHours.Additional_Time)) ELSE (0) END AS Plusovertime, CASE WHEN (SUM(JobHours.Additional_Time)) > 0 THEN ROUND(((Workers.Salary/300)*1.5),0) ELSE (0) END AS PlusRental, (Plusovertime+PlusRental) AS PULSNET FROM Workers INNER JOIN JobHours ON Workers.Worker_ID = JobHours.Worker_ID WHERE Jobhours.Start_Work BETWEEN @startdatetime AND @enddatetime GROUP BY Workers.Worker_ID, Workers.Full_Name,Workers.Salary ORDER BY Workers.Worker_ID;", conn);
SELECT Sum1, Sum2, Sum1+Sum2 AS Sum3 FROM ( SELECT SUM(Field1) AS Sum1, SUM(Field2) AS Sum2 FROM TableName GROUP BY ... ) AS T
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)