Re: [SQL] SQL subqueries newbie help

2003-09-07 Thread Alexei Chetroi
On Sat, Sep 06, 2003 at 01:21:36PM -0400, Rod Taylor wrote: > > I'd like to write a query which returns following information regarding > > each item: item, date of very first event, very last event. > > Is this possible? I think I can write several SELECT queries and > > procces them by an appli

Re: [SQL] SQL subqueries newbie help

2003-09-07 Thread Rod Taylor
On Sun, 2003-09-07 at 07:42, Alexei Chetroi wrote: > On Sat, Sep 06, 2003 at 01:21:36PM -0400, Rod Taylor wrote: > > > I'd like to write a query which returns following information regarding > > > each item: item, date of very first event, very last event. > > > Is this possible? I think I can wr

Re: [SQL] SQL subqueries newbie help

2003-09-07 Thread Alexei Chetroi
On Sun, Sep 07, 2003 at 09:09:35AM -0400, Rod Taylor wrote: > [skip] > > > > Thanks everybody for responses. I'm trying this one, but psql complains > > on queries like "SELECT min(date), event FROM events GROUP BY item" that > > events must be GROUPed or used in an aggregate function. Why thi

Re: [SQL] SQL subqueries newbie help

2003-09-07 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: > Oh yeah, sorry. It needs to be like that because otherwise it is unsure > what value to use for event. What you really want is a min function > that runs a min on date, and returns the appropriate event -- which > doesn't exist, but I believe could be crea