From: Peter Brawley Date: May 23 2006 2:05pm Subject: Re: I think I need a join List-Archive: http://lists.mysql.com/mysql/198213 Message-Id: <44731692.5030208@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Critters wrote: >I can get it to join on either countryA or countryB but not both :| SELECT d.id, d.day, c1.country, c1.id, c2.country, c2.id FROM days d INNER JOIN countries c1 ON d.countryA = c1.id INNER JOIN countries c2 ON d.countryB = c2.id ORDER BY d.id (Getting ready for the World Cup?) PB ----- > I think the following could be done with some sort of JOIN, but I am > now sure how: > > > > [country]: > id, country, number > 1, Germany, 27 > 2, Japan, 30 > 3, United States, 18 > > [days] > id, day, countryA, countryB > 10, monday, 1, 3 > 11, tuesday, 2, 3 > 12, wednesday, 1, 2 > > [result I want] > 10, monday, Germany, 27, United States, 18 > 11, tuesday, Japan, 30, United States, 18 > 12, wednesday, Germany, 27, Japan, 30 > > Hope that makes sence :) > > I can get it to join on either countryA or countryB but not both :| > -- > David > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.7.0/345 - Release Date: 5/22/2006