Re: [sqlite] MIN() for a timedelta?

2012-07-28 Thread C M
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

Re: [sqlite] MIN() for a timedelta?

2012-07-27 Thread Bernd Lehmkuhl
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

Re: [sqlite] MIN() for a timedelta?

2012-07-27 Thread Rob Richardson
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

Re: [sqlite] MIN() for a timedelta?

2012-07-26 Thread Keith Medcalf
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

Re: [sqlite] MIN() for a timedelta?

2012-07-26 Thread Keith Medcalf
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

Re: [sqlite] MIN() for a timedelta?

2012-07-26 Thread Igor Tandetnik
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

Re: [sqlite] MIN() for a timedelta?

2012-07-26 Thread Simon Slavin
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

Re: [sqlite] MIN() for a timedelta?

2012-07-26 Thread C M
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

Re: [sqlite] MIN() for a timedelta?

2012-07-26 Thread Nico Williams
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

[sqlite] MIN() for a timedelta?

2012-07-26 Thread C M
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