• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

sql query

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
reply
    Bookmark Topic Watch Topic
  • New Topic