List:General Discussion« Previous MessageNext Message »
From:Nick Pasich Date:April 25 2005 2:25am
Subject:Re: joining six tables by mutual column
View as plain text  
Try this....

If something is numeric....

SELECT * FROM table1, table2, table3, table4, table5, table6 
WHERE table1.something = table2.something
      AND
     table1.something = table3.something
     AND
     table1.something = table4.something
     AND
     table1.something = table5.something
     AND
     table1.something = table6.something
     ;


If something isn't numeric.....

SELECT * FROM table1, table2, table3, table4, table5, table6 
WHERE table1.something LIKE table2.something
      AND
      table1.something LIKE table3.something
      AND
      table1.something LIKE table4.something
      AND
      table1.something LIKE table5.something
      AND
      table1.something LIKE table6.something
      ;


          ----( Nick Pasich )----

On Mon, Apr 25, 2005 at 12:51:53AM +0200, Schalk Neethling wrote:
> Greetings everyone.
> 
> Hope someone can give me some pointers here. I have six tables in the 
> database and I need to JOIN them on a row that appears in all of the 
> tables. How do I do this? I have so far done the normal 'cross-join' 
> saying SELECT * FROM table1, table2, table3, table4, table5, table6 
> WHERE something = something;
> 
> I have also added STRAIGHT_JOIN to force the order but, how do I JOIN 
> six tables to/by one column? I have done some google searches as well as 
> looked at MySQL 2nd edition by Paul DuBois, sorry if I missed something 
> here Paul, and so far I have not found an answer. Any help or pointers 
> will be appreciated. Thank you.
> 
> -- 
> Kind Regards
> Schalk Neethling
> Web Developer.Designer.Programmer.President
> Volume4.Business.Solution.Developers
> emotionalize.conceptualize.visualize.realize
> Landlines
> Tel: +27125468436
> Fax: +27125468436
> Web
> email:schalk@stripped
> Global: www.volume4.com
> Messenger
> Yahoo!: v_olume4
> AOL: v0lume4
> MSN: volume4_@stripped
> 
> We support OpenSource
> Get Firefox!- The browser reloaded - 
> http://www.mozilla.org/products/firefox/
> 
> This message contains information that is considered to be sensitive or 
> confidential and may not be forwarded or disclosed to any other party 
> without the permission of the sender. If you received this message in 
> error, please notify me immediately so that I can correct and delete the 
> original email. Thank you.
> 
> 

Thread
joining six tables by mutual columnSchalk Neethling25 Apr
  • Re: joining six tables by mutual columnRichard Lynch25 Apr
  • RE: joining six tables by mutual columnmathias fatene25 Apr
    • Re: joining six tables by mutual columnSchalk Neethling2 May
      • Re: joining six tables by mutual columnPeter Brawley2 May
      • Re: joining six tables by mutual columnMichael Stassen2 May
  • Re: joining six tables by mutual columnNick Pasich25 Apr