Hello;
I want merge four MySQL tables to get the intersection that have a common field for all of them. Join two tables is fine to me, but my this case is different from common situations and there are not very many discussions about it. Can anybody give me some idea? Thanks a lot!
Here is part of my simplified tables (out of ~30000 rows per table and more than 10 columns of complicate formats, so that I do not want use shell command JOIN or other want to do the job!):
What I wanted is to pick up all rows of the three tables (B, C & D) by the common key from col1 of TableA, i.e. A1 ~ A6, if B, C & D share any key of each col2 of B, C & D. The 14 rows output seems to be correct, but with exhaust combination of the four tables.
The fact for this study is to pick up all the common genes of the three organisms with Arabidopsis (model plant) as the reference(key).
At first I was thinking about the technique part to retrieve common rows of four tables (3 tables at least). Now I need to think it over after Tyler's code for my purpose, as I did not take the redundant items (key) in B, C & D although items of col1 in TableA are unique.
Thank you anyway.
If you extend this requirement to the 4 tables and the original data in them, then your query in your first post is correct.
You should see 14 records as per your expectation here.