Re: build table from "logging" table, one row per user - oldest date

From: shakespeare <whatsin_at_xs4all.nl>
Date: Fri, 17 Sep 2010 19:47:33 +0200
Message-ID: <4c93a9bc$0$41121$e4fe514c_at_news.xs4all.nl>



Op 17-9-2010 1:37, okey schreef:
> I have a “logging” table. It records the user, login time, and other
> things.
>
> I want to create table within a statement that returns one row for
> each user. This row is the row containing the user’s oldest date
>
> Select blah blah from table x, (select user, date, other, info from
> logging where date is max) oldrows
> where x.date< oldrows.date
> and x.user = oldrows.user
>
> It’s building the table here that looks very difficult. This would be
> easy enough to do in pl/sql, but I rather do it this way, if it can
> even be done. This kind of thing is going to come up a lot.
>
> Thank you

select user, min(login_time)
from x
group by user

?

Shakespeare Received on Fri Sep 17 2010 - 12:47:33 CDT

Original text of this message