Helpful Information
 
 
Category: PostgreSQL Help
comparable to_days function in Postgres?

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]

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










privacy (GDPR)