🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #241

Re: Dates in SQL

#241
From: Steve Swanson
Date: Wed, 13 Jan 1999 00:00
28 lines
1382 bytes
In article <77j1h0$sll12@forums.borland.com>, "John Staub" <bmds@send_me_nothing_worldnet.att.net> wrote:
>I have an SQL statement that I've struggled through that I need to add a
>date type function to.  The SQL statement is:
>select * from afcert.dbf where (sent = false) and (sealno is not null) and
>(crtmld is not null) and (wrtn is not null) and (prac is not null) and
>(wrtpass = true) and (pracpass = true)
>
>There is a date field in the table (crtmld is the field) that I would like
>to test.  Basically I want to know if (crtmld + 60 < date()) and if so,
>include it.  I understand SQL does not support the date() function, but does
>anyone know of an equivalent in SQL?  I've tried a variety of approaches to
>no avail.
>
>Thanks,
>
>John
>
>
John

I've had good luck using parameters.

q = new query()
q.sql = 'select * from mytable.dbf where datefield  + 60 < :mdate'
q.params["mdate"] = date()
q.active = true

Steve
Technical Details
Message-ID: <77j6re$sli14@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <77j1h0$sll12@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,e21b85d41667a82e
X-Google-Attributes: gidff5a1,public
From: s.j.swanson@usa.net (Steve Swanson)
Subject: Re: Dates in SQL
Date: 1999/01/13
Message-ID: <77j6re$sli14@forums.borland.com>
X-Deja-AN: 432302431
References: <77j1h0$sll12@forums.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.vdbase.data.sql