Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sql query

 
Sanny kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
i want to write a sql query tht counts the total no of hours from the the table.
for example:
10:6:66(HH:MM:SS)
12:6:35 (HH:MM:SS)
7:9:60(HH:MM:SS)

then output will be 29:23:41 (HH:MM:SS).

can anyone plz give me suggestions???

Thanks in advance
santhosh
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try converting to your database's time format (or date) and then just add the values. The SQL functions for date/time are still pretty much database specific.

What database are you using?

Cheers,
 
Sanny kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi tom,

i m using oracle 8i

Santhosh
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Oracle you should be able to use something like:

SELECT SUM( TO_DATE( hoursfield, 'HH24:MI,SS')) AS tot_hrs;

Cheers,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic