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


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to