I made an error in my SQL when I did not include one of my non-aggregate columns in my group. I was surprised that Sqlite did not catch this, and even more surprised when the docs spelled out this behavior.
Is everyone ok with this? Do any other SQL engines allow this? (DB2 does not) Sent from my Verizon Wireless BlackBerry -----Original Message----- From: Stephen Chrzanowski <pontia...@gmail.com> Sender: sqlite-users-boun...@sqlite.org Date: Mon, 18 Oct 2010 06:30:28 To: General Discussion of SQLite Database<sqlite-users@sqlite.org> Reply-To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Subject: Re: [sqlite] Time calculation bug? Interesting. I get the same results as you when I use sqlite3.exe, but, in a database manager, the result comes back as I reported. I'll contact the developer of the utility and see if he can come up with something. On Mon, Oct 18, 2010 at 5:31 AM, Simon Davies <simon.james.dav...@gmail.com>wrote: > On 18 October 2010 09:28, Stephen Chrzanowski <pontia...@gmail.com> wrote: > > I seem to be having an odd behavioral problem with calculating time > stamps. > > > . > . > . > > For instance: > > > > select strftime('%s','now') RealUTC,strftime('%s','now','localtime') > > LocalTime, > > strftime('%s','now') - strftime('%s','now','localtime') > > > > Yeilds results of: > > RealUTC LocalTime strftime('%s','now') - > > strftime('%s','now','localtime') > > ---------- ---------- > > ------------------------------------------------------------- > > 1287389442 1290053442 -2664000 > > On my windoze7 m/c I set the time zone to Atlantic Time (Canada) (UTC > -04:00), and executed your query in sqlite3 shell: > > SQLite version 3.6.11 > Enter ".help" for instructions > sqlite> select strftime('%s','now') > RealUTC,strftime('%s','now','localtime') > ...> LocalTime, > ...> strftime('%s','now') - strftime('%s','now','localtime') > ...> ; > 1287394030|1287379630|14400 > sqlite> > > I do not see the problem that you report > > > > > I'm currently sitting in -0400 (EDT) and there should only be a maximum > of > > 14,400 seconds. 2664000 seems to add up to just under 31 days. > > > > Now, I'm writing the code that does the database management, and I've > > modified it so that when inserting/updating the time, its done with the > > date('2010-10-18 04:08:04','utc') to do the conversion, and the math > works > > without using UTC or LOCALTIME in the strftime functions but I'd still > like > > to know why the above SQL statement bombs? > > Regards, > Simon > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users