Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group