On 27 Jul 2012, at 12:04am, C M <cmpyt...@gmail.com> wrote: > On Thu, Jul 26, 2012 at 6:45 PM, Nico Williams <n...@cryptonector.com> 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 >> '9:12:32' ELSE '0' || '9:12:32' END)); >> >> Replace '9:12:32' there with whatever expression, probably a column name. > > Thanks but I can't figure out how to use that to get the MIN() > timedelta. For example, if I try this (the table is called > Durations...the column is duration): > > SELECT MIN(CASE WHEN duration LIKE '0%' THEN > duration ELSE '0' || duration END) FROM Durations WHERE duration != '' > > it returns: > 01:00:00:000000 > > which is definitely not the min timedelta in the table.
So explore it. Try variations until you can figure out what's going on. For example, execute SELECT MIN(duration) FROM Durations WHERE duration LIKE '0%' and SELECT MIN(duration) FROM Durations WHERE duration NOT LIKE '0%' and see what you get. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users