Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: (Newbie) Help with query.
"Karsten Farrell" <kfarrell_at_belgariad.com> wrote in message
> > select A.ts, a, b from A, B where B.ts>A.ts
> > This returns, for each a, all the b for which B.ts>A.ts...
> > I can't limit it with rownum
> >
> > I've also tried with a subselect:
> > select A.ts as myts, a, b from A, (select ...) where ...
> > select A.ts as myts, a, b from A, B where A.ts=(select ...)
> >
> > the problem is that I can't reference myts inside the subselect
> >
>
> TS A
> --------- ----------
> 04-JUN-03 -1
> 05-JUN-03 0
> 06-JUN-03 1
> 07-JUN-03 2
>
> 4 rows selected.
>
> SQL> select * from b;
>
> TS B
> --------- ----------
> 31-MAY-03 -500
> 02-JUN-03 -300
> 04-JUN-03 -100 <-- first b row > min a row
> 06-JUN-03 100
> 08-JUN-03 300
> 10-JUN-03 500
>
Thanks for your answer.
Well, in fact, I will have to explain myself better:
In the first table, there will be events of one type, and in the other one,
events of other type that have followed.
TS A
04-jun-03 10:30 -1 04-jun-03 10:35 0 04-jun-03 10:38 1 04-jun-03 10:41 2 TS B
04-jun-03 10:31 128 04-jun-03 10:36 129 04-jun-03 10:39 130 04-jun-03 10:42 131
So the list I'm trying to get is:
TS A B ======================= 04-jun-03 10:30 -1 128 04-jun-03 10:35 0 129 04-jun-03 10:38 1 130 04-jun-03 10:41 2 131
Is this feasible?
Thanks! Received on Fri Jun 06 2003 - 03:20:17 CDT