Hi

I having a little trouble with mysql, with the lack of sub-selects.

Yes, I have read about joins, both the manual and from the MySQL book by
Paul Dubois, but none of those provide any 'real' info about what to do.

It's ok to do join on table1, table2 and table3 as long as they are limited
to 10 records each, as in all of the examples you find on the net. But what
about my tables. I have one with 1,14 million and one with 136.000 and a
third with 65.000 records. What I want to do is to check for a match between
a record from table1 in table2 and from table1 to table3

ex. from table1 to 2:
select * from table1 where col1 in (select col2 from table2);

If I where to do a join on those tables I would, to my knowledge, end up
with a temp table with 1,14 * 136.000 * 65.000 records.. And that's a HUGE
table. I'm actually not even going to try it, because I'm pretty sure it
won't work.

The only solution I seem to find, is to include two new columns in table1,
where you give them either TRUE or FALSE based on the info put into table2
and table3.

So whenever I do an insert in table2 or 3, I also update corresponding
record in Table1 with TRUE in either one of the two columns.  <- Would this
be the 'right' way to do it? :)
This way I only have to retrieve the record from table1, check for TRUE
value in the two columns, if they are TRUE retrieve record from table2 and
from table3.

Would be nice to hear from someone who manages good sized databases.


Regards
Erlend Stromsvik



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to