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

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 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 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-06 Thread Rod Taylor
> 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 application or possibly write some procedure, but > what is better soluti

Re: [SQL] SQL subqueries newbie help

2003-09-06 Thread Bruno Wolff III
On Sat, Sep 06, 2003 at 14:07:09 +0300, Alexei Chetroi <[EMAIL PROTECTED]> wrote: > Hi All, > > I need a little help regarding writing some subqueries. For example I > have a table "items" which contains columns: itemid, description; and > another table "events" with columns: itemid, date, eve

[SQL] SQL subqueries newbie help

2003-09-06 Thread Alexei Chetroi
Hi All, I need a little help regarding writing some subqueries. For example I have a table "items" which contains columns: itemid, description; and another table "events" with columns: itemid, date, event. events.itemid references items.itemid. Table events contains events regarding some itemid'