PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 22nd, 2001, 03:58 PM
Kyuzo Kyuzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113 Kyuzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Hey all,

Does anyone know of a corresponding Postgres to_days() type function as exists in MySQL?? ....trying to get the total number of records between now() and 30 days ago by referencing the "posted" column of a table.

The following works....

> SELECT * from table_name
> WHERE trim(substr(now()-posted, 1, 2))::integer <= 30;

...but just wondering if there was anything more direct.

Thanks in advance,

Kyuzo
Nou ga aru taka wa tsume o kakusu

[Edited by Kyuzo on 01-22-2001 at 03:00 PM]

Reply With Quote
  #2  
Old January 22nd, 2001, 04:09 PM
Kyuzo Kyuzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113 Kyuzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Got it...I RTFMed

> SELECT * from table_name
> where posted >= now() - 30;

still would like to know if there's a comparable to_days() function

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > comparable to_days function in Postgres?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT