Re: [GENERAL] interval questions

2000-06-01 Thread Michael Blakeley
At 10:21 PM -0500 6/1/2000, Ed Loehr wrote: >Michael Blakeley wrote: >> >> CREATE TABLE EVENTS( stamp date, id varchar(16), event varchar(128) ); >> >> I'm trying to find the average age of the records. I've gotten as far as: >> SELECT DISTINCT ON(id) age(stamp) FROM EVENTS; >> >> Now,

Re: [GENERAL] interval questions

2000-06-01 Thread Ed Loehr
Michael Blakeley wrote: > > CREATE TABLE EVENTS( stamp date, id varchar(16), event varchar(128) ); > > I'm trying to find the average age of the records. I've gotten as far as: > SELECT DISTINCT ON(id) age(stamp) FROM EVENTS; > > Now, I need the DISTINCT ON(id), but that means I can't s

Re: [GENERAL] interval questions

2000-06-01 Thread Alfred Perlstein
* Michael Blakeley <[EMAIL PROTECTED]> [000601 19:09] wrote: > I hope someone on the list can suggest a solution for me - given a table like > > CREATE TABLE EVENTS( stamp date, id varchar(16), event varchar(128) ); > > I'm trying to find the average age of the records. I've gotten as far as: >

Re: [GENERAL] interval questions

2000-06-01 Thread Tom Lane
Michael Blakeley <[EMAIL PROTECTED]> writes: > I'm trying to find the average age of the records. I've gotten as far as: > SELECT DISTINCT ON(id) age(stamp) FROM EVENTS; > Now, I need the DISTINCT ON(id), but that means I can't simply avg() the age: > ERROR: Attribute events.id must

[GENERAL] interval questions

2000-06-01 Thread Michael Blakeley
I hope someone on the list can suggest a solution for me - given a table like CREATE TABLE EVENTS( stamp date, id varchar(16), event varchar(128) ); I'm trying to find the average age of the records. I've gotten as far as: SELECT DISTINCT ON(id) age(stamp) FROM EVENTS; Now, I need the D