Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id JAA07835 for ; Fri, 29 Oct 1999 09:45:28 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id JAA01897; Fri, 29 Oct 1999 09:44:55 -0400 (EDT) To: holm@freibergnet.de cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] Problem with datetime In-reply-to: Your message of Fri, 29 Oct 1999 10:14:30 +0200 <19991029101430.B65318@pegasus.freibergnet.de> Date: Fri, 29 Oct 1999 09:44:55 -0400 Message-ID: <1895.941204695@sss.pgh.pa.us> From: Tom Lane Holm Tiffe writes: > But now both days at on time: > SELECT sum(stop-start) FROM logs WHERE name = 'intern-mw' and start> = '27-10-1999' AND stop < ('28-10-1999'::datetime + '1 day'::timespan); > sum > ------------------------- > @ 12 hours 51 mins 4 secs > (1 row) > uups what's happening here ? > I've doublechecked the WHERE clause, It is ok, the right tuples are selected, > but 3h + 4.5h are not 13h! Wat I'm doing wrong here ? Maybe I'm missing something obvious, but it seems to me that the above command will include log entries that cross the midnight boundary between the two dates, whereas neither of the other two do. Seems like you must have about 5.5h worth of such entries... regards, tom lane