Re: if else query help
От | Jean-Christophe Boggio |
---|---|
Тема | Re: if else query help |
Дата | |
Msg-id | 6812102772.20001012165653@thefreecat.org обсуждение исходный текст |
Ответ на | if else query help ("Brian C. Doyle" <bcdoyle@mindspring.com>) |
Ответы |
Re: if else query help
|
Список | 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 t2where t1.itemid=t2.itemid -- to link thetables 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@thefreecat.org Independant Consultant and Developer Delphi, Linux, Oracle, Perl
В списке pgsql-sql по дате отправления: