Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL: Working with huge tables of chronological data
"John" <acide.ascorbique_at_gmail.com> wrote in news:1175802637.291526.37550
@p77g2000hsh.googlegroups.com:
>> Is this the real problem or a simplification?
>> Is this something that will be run once or repeatedly?
>> Is it possible for the same time to be in A and B?
>> Is it possible to have a B before an A beginning the sequence? >> Is it possible for there to be multiple Bs between As?
I would NOT use SQL to solve this problem.
I'd use Perl or PL/SQL.
Treat Table_A & Table_B as ordered lists (based upon field of choice;
timestamp, ID , whatever).
You only needs to pass thru each list a single time.
Open two read loops; one on A & one on B.
Read 1 record from each list.
1) If A < B, then read record from A. 2) If A < B, then you found 1st hit & read record from A 3) If B < A, then read record from B 4) If B < A, the you have a hit & read record from Betc. loop until no more records Received on Thu Apr 05 2007 - 22:03:56 CDT