I have posted some script below which works out the totals
SELECT *
FROM (
SELECT cast([Id] AS VARCHAR(20)) AS ID
,[Site]
,convert(VARCHAR(20), [jobdate], 101) AS [job date]
,[submittime]
,[totalfirstjobs]
,[totalSecondJobs]
,[totalThirdjobs]
,[nightwork]
,[totalfirstjobs] + [totalsecondjobs] + [totalthirdjobs] + [nightwork] AS [Total all Jobs]
FROM site_total
WHERE convert(VARCHAR(20), [jobdate], 101) = convert(VARCHAR(20), getdate(), 101)
UNION
SELECT 'Totals'
,NULL
,convert(VARCHAR(20), [jobdate], 101)
,NULL
,sum(totalfirstjobs)
,sum(totalsecondjobs)
,sum(totalthirdjobs)
,sum(nightwork)
,sum(totalfirstjobs) + sum(totalsecondjobs) + sum(totalthirdjobs) + sum(nightwork)
FROM site_total
GROUP BY [jobdate]
) tbla
where cast([job Date] as date) =cast(getdate() as date)
ORDER BY [job Date ]
What i need to do is get a percentage for the first jobs, this needs to be an extra colum in the table below is how it needs to be worked out
I have made an error its got to be
total overall 1st Jobs divided by total overall jobs times by 100 = %
I just need some way of getting the percentage using the above method not working with percentage so hence why asking for help on implementing this.