Skip to content
Advertisement

Multiple SUM’s in a SELECT but on one view

I’ve written a select statement to assist with timesheet approval. It show’s the summation of hours entered against a user based on different roles booked, i.e. Standard Office Hours, Overtime, Holiday & Offshore.

I want a single row per [Name] but I get a row for every SUM where the user has data.

Do I need to create this as a view and SELECT to that view?

My current code is below:

Advertisement

Answer

You should just use the group by for the columns you really want aggregate, tipilcally the same columns you have in select but not with an aggreagtion functions

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement