Re: [GENERAL] casting... adding integer to timestamp

2006-06-25 Thread Mark Gibson
Michael Glaesemann wrote: On Jun 25, 2006, at 14:23 , Mark Gibson wrote: SELECT play_length - INTERVAL 'play_seconds seconds' ... The column isn't interpolated into the string. Try SELECT play_length - play_seconds * INTERVAL '1 second' That worked great! Thanks! Mark -

Re: [GENERAL] casting... adding integer to timestamp

2006-06-25 Thread Alex Pavlovic
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

Re: [GENERAL] casting... adding integer to timestamp

2006-06-24 Thread Frank Finner
On Sat, 24 Jun 2006 23:23:57 -0600 Mark Gibson <[EMAIL PROTECTED]> thought long, then sat down and 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

Re: [GENERAL] casting... adding integer to timestamp

2006-06-24 Thread Michael Glaesemann
On Jun 25, 2006, at 14:23 , Mark Gibson wrote: SELECT play_length - INTERVAL 'play_seconds seconds' ... The column isn't interpolated into the string. Try SELECT play_length - play_seconds * INTERVAL '1 second' Hope this helps. Michael Glaesemann grzm seespotcode net -

[GENERAL] casting... adding integer to timestamp

2006-06-24 Thread Mark Gibson
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