From: | Jean-Christophe Boggio <cat(at)thefreecat(dot)org> |
---|---|
To: | "Brian C(dot) Doyle" <bcdoyle(at)mindspring(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: if else query help |
Date: | 2000-10-12 14:56:53 |
Message-ID: | 6812102772.20001012165653@thefreecat.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
hi Brian,
BCD> I need to write a query that will pull information from table2 if
BCD> information in table1 is older then xdate.
BCD> My laymen example:
BCD> SELECT table2.date, count(table2.name) as count
BCD> WHERE table1.startdate > 2 weeks
BCD> AND table2.submitdate > 2 weeks
BCD> ;
BCD> So i Guess my real questions is how do I determine the age of an entry to
BCD> another table?
Try this :
Select table2.date,count(table2.name) as count
from table1 as t1, table2 as t2
where t1.itemid=t2.itemid -- to link the tables
and t1.startdate>now()-14
and t2.submitdate>now()-14;
Someone corrects me if I'm wrong, I come from the Oracle world...
Dates (or I should say TimeStamps) are stored as floating point values
: the integer part is the number of days since a certain date
(epoch or 01/01/1970 on unix-based databases) and the fractionnal part is the
portion of the day (although I don't know --yet-- how to convert
date2-date1 to an integer, trunc does not work).
HTH
--
Jean-Christophe Boggio
cat(at)thefreecat(dot)org
Independant Consultant and Developer
Delphi, Linux, Oracle, Perl
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2000-10-12 15:35:39 | Re: if else query help |
Previous Message | Mark Volpe | 2000-10-12 14:22:12 | Re: dynamic object creation |