Allen Fowler wrote:
>
>
>
>> You could be storing event duration, not stop time. Or perhaps store
>> both.
>>
>>
>
> Here is what I have so far:
>
> sqlite> create table events (id INTEGER PRIMARY KEY AUTOINCREMENT, name,
> kind, start, end);
>
> # Now add some events for "tomorrow"
> s
Allen Fowler wrote:
> # Show all events and duration:
> sqlite> select *, (strftime('%s', end) - strftime('%s', start)) as
> length from events;
> idname kind
> start end length
> ---
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Allen Fowler wrote:
> Indeed, I am aware that SQL is not a "traditional" programming language
> per-se and have will now be writing the calendar logic at the application
> level. (Looking at Python...)
You may want to get a good understanding of wh
On 13/06/2009 9:05 AM, Allen Fowler wrote:
> Indeed, I am aware that SQL is not a "traditional"
> programming language per-se and have will now be writing
> the calendar logic at the application level. (Looking at Python...)
Don't look any further :-)
Check out the dateutil module...
http://la
> Simon Slavin wrote:
>
>
> I'm not sure you appreciate what Roger (please be more careful about
> your quoting, by the way) is telling you. SQL is not a programming
> language. It's a way of accessing a database. The two are not at all
> equivalent: everything you can do in SQL you can
On 12 Jun 2009, at 11:14pm, Allen Fowler wrote:
>> You'll probably find it easier to write the processing algorithm in
>> the
>> programming language of your choice. This will allow you to print
>> out
>> diagnostics as you go along, play with a debugger etc. To make it
>> easy
>> to map
> >
> > What am I missing here? Am I doing the query wrong?
>
> Yes. The "group by" doesn't know which rows to use for columns that
> are not either aggregate functions (such as min) or grouped columns
> (such as name). You know what min() does, but the query processor
> doesn't.
>
Ok
>
> I'd recommend continuing down the path you are exploring which is having
> test data and tweaking/tuning/correcting your queries until they are
> acceptable.
>
> You'll probably find it easier to write the processing algorithm in the
> programming language of your choice. This will allow
On Jun 12, 2009, at 3:46 PM, Allen Fowler wrote:
> sqlite>
> select *, min((strftime('%s', end) - strftime('%s', start))) as
> length
> from
> ...> events where
> ...> start < datetime('now', '+1 day','start of day',
> '+9 hours','+30 minutes')
> ...> and end > datetime('now', '+1 day','
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Allen Fowler wrote:
> What am I missing here? Am I doing the query wrong?
It would take a considerable number of iterations to help get the
queries exactly correct, especially as there are lots of details as you
note such as sort order etc :-)
I'd r
>
> You could be storing event duration, not stop time. Or perhaps store
> both.
>
Here is what I have so far:
sqlite> create table events (id INTEGER PRIMARY KEY AUTOINCREMENT, name, kind,
start, end);
# Now add some events for "tomorrow"
sqlite>
insert into events values (null, 'tom'
11 matches
Mail list logo