[Zope-DB] Question on ZSQL and Dates

kapil thangavelu kvthan@wm.edu
Wed, 23 Oct 2002 22:12:06 -0700

On Wednesday 23 October 2002 08:15 am, Charlie Clark wrote:
> Hi,
> I've been struggling for a while with this one: I need to be able compare
> dates/ages in a ZSQL-query and don't seem to be able to do it right.
> table person
> name varchar(20),
> id int,
> birthdate date
> Now I want to be able to select all rows in the table for people who are
> currently over 45 years old.
> SELECT * FROM person
> 45 <= '<dtml-var expr=" .DateTime().Date()">' - person.birthdate

you need some casting, as this expression really doesn't make any sense as is.
your subtracting a date and a string, to hopefully get some sort of time 
delta, and comparing to an integer??

i would take a look at your vendor literature for date comparison and casting.