Thanks everyone for the various replies and help. Very useful and I
will look into the differences and if I have questions about how these
work will let you know.
Thank you,
Che
___
sqlite-users mailing list
sqlite-users@sqlite.org
the shortest duration (the smallest timedelta) using
the SQLite MIN(), like so:
SELECT MIN(duration) FROM Durations
The problem is, in Python, the string representation of the timedelta
is not left zero padded, so '9:00:00.00' (nine hours) is selected
by MIN() as greater than '10:01:23:041000
See below.
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
On Behalf Of Simon Slavin
Sent: Thursday, July 26, 2012 8:47 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] MIN() for a timedelta?
On 27 Jul 2012, at 12:04am
te.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of C M
> Sent: Thursday, 26 July, 2012 15:33
> To: General Discussion of SQLite Database
> Subject: [sqlite] MIN() for a timedelta?
>
> I have string representations of a Python timedelta stored in an
> SQLite database of the fo
6 July, 2012 15:33
> To: General Discussion of SQLite Database
> Subject: [sqlite] MIN() for a timedelta?
>
> I have string representations of a Python timedelta stored in an
> SQLite database of the form H:MM:SS:ss (the last is microseconds).
> Here are a possible examples
the shortest duration (the smallest timedelta) using
the SQLite MIN(), like so:
SELECT MIN(duration) FROM Durations
Something like this perhaps:
select min(substr('0', 1, 15-length(duration)) || duration) from Durations;
--
Igor Tandetnik
___
sqlite-users
On 27 Jul 2012, at 12:04am, C M wrote:
> On Thu, Jul 26, 2012 at 6:45 PM, Nico Williams wrote:
>>
>>
>> Just use CASE to add the missing zero as necessary, something like this:
>>
>> SELECT strftime('%s', (SELECT CASE WHEN '9:12:32' LIKE '0%' THEN
On Thu, Jul 26, 2012 at 6:45 PM, Nico Williams wrote:
> On Thu, Jul 26, 2012 at 4:32 PM, C M wrote:
>> I could zero pad these strings myself, so that '9:00:00.00'
>> becomes '09:00:00.00', but that would break other uses of these
>> values in my
On Thu, Jul 26, 2012 at 4:32 PM, C M wrote:
> I could zero pad these strings myself, so that '9:00:00.00'
> becomes '09:00:00.00', but that would break other uses of these
> values in my code and was wondering if there were a way in SQlite to
> "see" these values as
timedelta) using
the SQLite MIN(), like so:
SELECT MIN(duration) FROM Durations
The problem is, in Python, the string representation of the timedelta
is not left zero padded, so '9:00:00.00' (nine hours) is selected
by MIN() as greater than '10:01:23:041000' (ten hours and change
10 matches
Mail list logo