Re: Compare an integer to now() - interval '3 days'

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Compare an integer to now() - interval '3 days'
Date: 2011-03-11 13:36:20
Message-ID: AANLkTi=fBtJeFTo8Rd2EEE6Tk=57Kz3kCvrdEGWSxgbu@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11 March 2011 14:14, Alexander Farber <alexander(dot)farber(at)gmail(dot)com> wrote:

>
> # select u.uid, u.name, u.created
> from drupal_field_data_field_gender g, drupal_users u
> where g.field_gender_value='Robot' and
> u.uid=g.entity_id and u.created::timestamp > now() - interval '1 day';
> ERROR: cannot cast type integer to timestamp without time zone
> LINE 4: u.uid=g.entity_id and u.created::timestamp > now() - interva...
>
> What should I use instead of ::timestamp please?
>
>
Hi,
try this:

to_timestamp(u.created)

regards
Szymon

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vibhor Kumar 2011-03-11 13:46:02 Re: Compare an integer to now() - interval '3 days'
Previous Message David Johnston 2011-03-11 13:35:46 Re: Compare an integer to now() - interval '3 days'