using dates in pgsql

From: JohnH <JohnH(at)atkgib(dot)com(dot)au>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: using dates in pgsql
Date: 2003-08-26 23:48:03
Message-ID: 61AE72B81760D511B2DC0002B345C83A1352EE@DFS1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

G'Day to all those pgsql novices out there

I am trying to isolate those records where the active date is at least six
months old

I have no problem if I use

SELECT * from newbuyers
WHERE activedate < '01/01/2003'
ORDER BY last_name

But I want to use a variable in the WHERE option

WHERE activedate < (current date less 188 days)

active date is a database date field

I would like to include the calculation in the WHERE statement, but if I
can't should I create the (current date less 188 days) outside of the sql
and bring it in as a <dtml-sqlvar ...> variable? and if so how?


Thanks to anyone who can help

John Haley


Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stuart Woodward 2003-08-27 08:58:08 Upgrading from 7.1.2 to 7.3.3 - function may need to add explicit typecasts
Previous Message Michael Guerin 2003-08-26 23:11:53 Simple queries take forever to run