I admit, after making my post and taking a break, I had gotten a
little ahead of myself when stating this problem.  Basically, I had
reached a point where I was able to get to @arr3, and couldn't figure
the rest out; the previous stuff I figured out.  I felt I needed to
come up with some background info and perhaps it just made things more
confusing.  More significantly, I also didn't know much of the correct
terminology/what things were called officially...

If you're curious to know the background info (I wanted to make it as
less specific as possible), I have a table in a MySQL database that
contains a list of tailored information about other tables in that
same database.  Certain technicalities had forced me not to use
InnoDB's and thus, I cannot use any foreign keys; the information
within that table of tables is a way for me to automatically make
those connections between tables.  When I mentioned A and C in @arr1,
A is a record that represents another table in that database, C
likewise.  B is also a record in the table, and there are references
to A = B and B = C/they link together...

Thus, if you're attempting to come up with a dynamic select query,
you'll have to come up with some tricky coding to include all the
tables that are given within the statement.  ie, if you specify a
field from one table, and a field from another, you'll have to specify
something like this: SELECT A.field1, C.field1 FROM A, C;

If I specify only A and C, it will return a very long list; basically,
for every record in A, it will return the total # of records in table
C, which means A * C records (a lot if there are just 10+ in each/
either... ) So, because A = B, and B = C, you have to include B in
your statement, like so: SELECT A.field1, C.field1 FROM A, B, C WHERE
A.fieldX = B.fieldY AND B.fieldZ = C.fieldX.  The part after WHERE is
a way of 'JOIN'ing the tables...

If I want to specify just A, and just C, pass them to a perl sub,
based on the ties of A = B, and B = C, I'd like to return A = B = C.

If I have other records in that special table that have references of
A and C, eg, A = D and E = C, I'd like to not include those because
they don't 'share' B; so if I don't account for that, and include all
of the tables that link to others, I'll limit my query even more (eg,
SELECT A.field1, C.field1 FROM A, B, C, D, E WHERE A.fieldX = B.fieldY
AND B.fieldZ = C.fieldX AND A.fieldY = D.fieldX AND C.fieldY =
E.fieldX)  If I don't specify D and E in the FROM, I'll get an
error...

So, basically, I only really need help on the part of 'merging' A = B
and B = C to get only A = B = C, and not A = B = C = D = E (because of
the example I just mentioned).  It sounds so trivial, hence why I
submitted this in this discussion.  But, on the other hand, I don't
know if it's something a bit more technical or if I've made this seem
even more complicated or confusing... :-\

Oh, and with A = B and B = C, A = D and E = C, they can all be
flipped, eg, D = A...  I don't need to preserve the order of each
'set'...

Really appreciate your help with this!

-Nick


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to