Re: SQL query - help needed
Date: Thu, 26 Apr 2001 12:42:12 GMT
Message-ID: <3AE8178E.5D118CDF_at_cgi.ca>
Hi Lynn,
If file a is your primary key table you'll get a row returned for each matching
entry in table b (the one with your foreign key)...when you say fields I'm
thinking columns..is that what you mean?
Lets try it with an example...if you have dept 10 (parent table) and that department has 50 employees (child), an equijoin as I've described will return 50 records matching the one record (dept 10) in your parent table..is this what you're asking?
If I'm misinterpreting the question, feel free to email me directly.
Steve
"Lynn C. Ormond" wrote:
> Will that create the same number of fields for each row if there are 5
> matches for the first record in file a and
> 2 for the second record and none for the third?
>
> --
>
> Lynn C. Ormond
> Lucero Research
> Reply to: Lynn_at_Lucero.com
> (520) 537-1300 x120
> Please include company name in message
>
> Stephen Bell <stephen.bell_at_cgi.ca> wrote in message
> news:3AE6C4CF.FBA4878E_at_cgi.ca...
> > Lynn,
> > It sounds like the base tables have a Primary/Foreign key
relationship..what if
> > you construct a view to suit what you need? It sounds like all you need is
an
> > equijoin based on your statement that you want the same number of fields
in each
> > row..an equijoin will produce a result for each of the multiple values in
the
> > foreign key that correspond to each unique key value...so your WHERE
clause
> > would simply be:
> >
> > WHERE fk_of_small_table = unique_key_of_100000_record_table;
> >
> > Please let me know if I misinterpreted your question.
> >
> > Steve
> >
> > "Lynn C. Ormond" wrote:
> >
> > > I have 2 Oracle 7 views I need to combine with a select statement.
> > >
> > > The first has 100,000 + records with a unique key. The second has
multiple
> > > records ( or none ) on the same key.
> > >
> > > I need left join(?) syntax which will allow me to get all of the
multiple
> > > records in the second file attached to each of the unique records in the
> > > first file, always having the same total number of fields in each row of
the
> > > result set.
> > >
> > > Any ideas?
> > >
> > > --
> > >
> > > Lynn C. Ormond
> > > Lucero Research
> > > Reply to: Lynn_at_Lucero.com
> >
Received on Thu Apr 26 2001 - 14:42:12 CEST