Jump to content
Sign in to follow this  
tglaser

Adding a Summary

Recommended Posts

Hello , 

 

i am struggling to identify how to add a summary row to a query I am implementing. I have 2 columns, Name, time worked, I want to identify two things; 1. the total time worked per name, and 2 the total time worked by everyone. Can you help ?

Current Query:

SELECT Name, sum(hours) AS Hours

FROM timecard

Group by Name;

 

Goal shown below. 

Name   Hours 

John      5

Mary      6

Ed          7

Total     18<----THIS IS THE ROW I NEED TO ADD!!!

Share this post


Link to post
Share on other sites

The sum would come from another query, although depending on which database you're using you can probably use subqueries to group the results from multiple queries into one result set.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...