Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Beginner SQL question (on intersecting groups of records)....

Beginner SQL question (on intersecting groups of records)....

From: dean <deanbrown3d_at_yahoo.com>
Date: 2 Dec 2005 06:18:55 -0800
Message-ID: <1133533135.758692.245130@z14g2000cwz.googlegroups.com>


Hi there, I need to ship something from A to B. I have a group of trains T1 that leave station A and head out, and another group of trains T2 that I know go to station B.

I want to find out what pairs of trains from T1 and T2 can take me from A to B, assuming there are no direct trains. (Actually they are freight trains).

Given that a particular train T1a leaves A and hits 100 more stations (call it set S), I need to know which trains in group T2 also hit at least one of these stations in S. Then I need to do the same thing for all trains in T1.

Is there an efficient way to know if there is some intersection between the two groups of stations? Like, as soon as one common station is found, then stop searching. I could do it with a count, but that is going to be way to slow given the number of trains and station records foe each train.

Thanks for any help,

Dean Received on Fri Dec 02 2005 - 08:18:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US