By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,042 Members | 1,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,042 IT Pros & Developers. It's quick & easy.

Adding Time Totals in SQL

P: n/a

I am trying to get a total for times, but I am having trouble getting
anything to work. Basically I created a query to pull up several
people's name that performed certain details and how long each detail
was. I now want to add up all the hours to a total for each person. Can
anyone point me in the right direction?
*** Sent via Developersdex http://www.developersdex.com ***
Dec 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
MC
Wh dont you show us an example? How does the table look and offcourse what
are the datatypes? Also, please post what would you want as a result of the
query.

MC
"Bob W" <bl**************@hotmail.com> wrote in message
news:Uf***************@news.uswest.net...

I am trying to get a total for times, but I am having trouble getting
anything to work. Basically I created a query to pull up several
people's name that performed certain details and how long each detail
was. I now want to add up all the hours to a total for each person. Can
anyone point me in the right direction?
*** Sent via Developersdex http://www.developersdex.com ***

Dec 12 '05 #2

P: n/a
Bob W (bl**************@hotmail.com) writes:
I am trying to get a total for times, but I am having trouble getting
anything to work. Basically I created a query to pull up several
people's name that performed certain details and how long each detail
was. I now want to add up all the hours to a total for each person. Can
anyone point me in the right direction?


SELECT name, totime = SUM(detaillength)
FROM tbl
GROUP BY name

For a more accurate answer, I recommend that you post:

1) CREATE TABLE statements for your tables.
2) INSERT statements with sample data.
3) The desired result given the sample.

This will very likely give you a tested solution.

The less information you disclose, the less accurate and the less
useful the answers will be.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.