#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    15
    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]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    15
    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

IMN logo majestic logo threadwatch logo seochat tools logo