[SQL] Create interval using column value?

2004-10-24 Thread Larry Lennhoff
Hi I have a table (A) with a integer column called build_interval, which contains the number of milliseconds betweeen builds. I have another table (B) with a timestamp with timezone column called built_on. The two tables share a column called join_col. What I want to do is find all the rows i

Re: [SQL] Create interval using column value?

2004-10-24 Thread Tom Lane
Larry Lennhoff <[EMAIL PROTECTED]> writes: > What I want to do is find all the rows in > A which were built before now() - build_interval seconds ago. If I could > just write this in SQL it would look something like: > SELECT A.id FROM A JOIN B ON (join_col) WHERE built_on < now() - interval >

Re: [SQL] Create interval using column value?

2004-10-24 Thread Larry Lennhoff
Thanks, that was exactly what I needed. Larry ]At 11:11 PM 10/24/2004, Tom Lane wrote: Larry Lennhoff <[EMAIL PROTECTED]> writes: > What I want to do is find all the rows in > A which were built before now() - build_interval seconds ago. If I could > just write this in SQL it would look something

Re: [SQL] Create interval using column value?

2004-10-24 Thread Michael Glaesemann
On Oct 25, 2004, at 11:54 AM, Larry Lennhoff wrote: SELECT A.id FROM A JOIN B ON (join_col) WHERE built_on < now() - interval 'build_interval seconds'; It would help to see the error you're getting, but I suspect it has something to do with the fact that you're quoting 'build_interval'. Try some