select Personid, firstname, lastname, Sum(reghours), YearWeek
from TimeSheet
group by PersonId
order by FirstName, LastName
I am trying to figure out how I could write a stored procedure without any parameters and for it to calculate total hours an employee worked in a given timeframe or would I have to have some parameters. I have yearweek I can use but how could I write the query to sum up the hours for a given year and separate them in columns. I am not sure if this makes sense.