Requête SELECT à partir de données dans 2 tables
Bonjour,
voici 2 tables :
Code:
1 2 3 4 5 6 7 8 9 10
|
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`customer_id` smallint NOT NULL AUTO_INCREMENT,
`customer_login_id` int DEFAULT NULL,
`country_key` smallint DEFAULT NULL,
`organization` varchar(50) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`customer_id`),
UNIQUE KEY `customer_login_id_UNIQUE` (`customer_login_id`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; |
Code:
1 2 3 4 5 6 7 8
| DROP TABLE IF EXISTS `country`;
CREATE TABLE `country` (
`country_key` smallint NOT NULL AUTO_INCREMENT,
`country` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`region` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '',
PRIMARY KEY (`country_key`),
UNIQUE KEY `uk_country` (`country`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; |
Je souhaite extraire les données customer_login_id, organization et country. Donc les 2 premières colonnes appartiennent à la première table et la 3e colonne à la seconde table.
Je crois savoir qu'un bug de MySQL nécessite de passer par une table temporaire. Néanmoins, je n'y parviens pas. Merci de votre aide.