Jonathan O <[EMAIL PROTECTED]> wrote:
On 11/19/07, Igor Tandetnik <[EMAIL PROTECTED]>
wrote:

Jonathan O
<[EMAIL PROTECTED]>
wrote:
I have searched (archives/google) and haven't found a solution for
what I need and can't think of a solution so below is my question.
I have:
  Job 1 run 1 with a time of '01:00:15'
  Job 1 run 2 with a time of '01:00:21'

What I do is:

select sum(strftime('%H%M%S', time_column))/2 from table;
10018

You probably want

select strftime('%H:%M:%S', AVG(time_column)) from tablename;


Doesn't seem that way.

select strftime('%H:%M:%S', avg('01:00:15' + '01:00:21')/2;
12:00:00

I don't understand - do you want an average of two fixed values, or an average of values of a particular column across all rows? The statements you show don't make any sense at all.

What does the data in time_column look like?

The time data type is how long something takes to finish in HH:MM:SS
or MM:SS or similar right?

There is no time data type in SQLite - only strings, numbers, and a set of functions to convert between the two. To store time durations, it's probably easiest to just store them as integers representing time in seconds, and format with strftime whenever you need string representation (either in SQLite statement, or in your application code).

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to