Re: casting... adding integer to timestamp

From: Alex Pavlovic <alex(dot)pavlovic(at)taskforce-1(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Mark Gibson <mark(at)gibsonsoftware(dot)com>
Subject: Re: casting... adding integer to timestamp
Date: 2006-06-25 09:39:45
Message-ID: 200606250239.46436.alex.pavlovic@taskforce-1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yet another way, this time being more explicit.

SELECT play_length - play_seconds * '1 second'::interval

Cheers.

On Saturday 24 June 2006 22:23, Mark Gibson wrote:
> If play_length is a timestamp, I can do this:
>
> SELECT play_length - INTERVAL '13 seconds' ...
>
> But what if play_seconds is a column?
>
> SELECT play_length - INTERVAL 'play_seconds seconds' ...
>
> This doesn't work.
>
> ERROR: invalid input syntax for type interval: "play_seconds seconds"
>
> Can anyone help?
>
> Thanks,
> Mark
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

In response to

Browse pgsql-general by date

  From Date Subject
Next Message chrisek 2006-06-25 19:05:04 "Ghost" colmumn with primary key
Previous Message Sim Zacks 2006-06-25 07:27:58 Re: join on next row