Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 20th, 2005, 12:39 PM
rbeaulieu rbeaulieu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 rbeaulieu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 15 sec
Reputation Power: 0
Query of the Sum of a Time field

Hello,

I would like to make a sum with Time field but I got a error message concerning bad aritmetic datatype.

This is my query :

SELECT SUM(TEMPS_DIRECT) FROM WORKS;

How I can make a time's sum ?

Thanks !

Reply With Quote
  #2  
Old February 21st, 2005, 01:54 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 978 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 22 h 40 m 34 sec
Reputation Power: 57
Dumb question: what's the sum of 14:36 and 22:51?

Reply With Quote
  #3  
Old February 21st, 2005, 03:43 AM
IvanP IvanP is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 12 IvanP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 37 sec
Reputation Power: 0
Quote:
Originally Posted by rbeaulieu
I would like to make a sum with Time field but I got a error message concerning bad aritmetic datatype.

This is my query :

SELECT SUM(TEMPS_DIRECT) FROM WORKS;

How I can make a time's sum ?

TIME datatype holds day time, not time duration, so it has no sense to sum TIMEs directly. If you (incorrectly) hold time duration in TIME field, the workaround for computing the sum is this

SELECT SUM(TEMPS_DIRECT - cast('0:0' as time)) FROM WORKS;

(the result is number of seconds)

Ivan
http://www.volny.cz/iprenosil/interbase/

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Query of the Sum of a Time field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway