* Bonjour, *
Help je craque !
J'ai deux tables :
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 -- Structure de la table `Bureau` CREATE TABLE IF NOT EXISTS `Bureau` ( `ID` int(5) NOT NULL AUTO_INCREMENT, `Nom` text COLLATE utf8_roman_ci NOT NULL, `Prenom` text COLLATE utf8_roman_ci NOT NULL, `Fonct` text COLLATE utf8_roman_ci NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_roman_ci COMMENT='Membres bureau' AUTO_INCREMENT=8 ; -- Contenu de la table `Bureau` INSERT INTO `Bureau` (`ID`, `Nom`, `Prenom`, `Fonct`) VALUES (1, 'Perroquin', 'Michelle', 'Présidente'), (2, 'Daniel', 'Michelle', 'Trésorière'), (3, 'Retsinias', 'Patricia', 'Secrétaire'), (4, 'Daniel', 'François', 'Membre'), (5, 'Gole', 'Martine', 'Membre'), (6, 'Spasaro', 'Isidore', 'Membre');
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 -- Structure de la table `Absence` CREATE TABLE IF NOT EXISTS `Absence` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Num` int(11) NOT NULL, `Mois` text COLLATE utf8_roman_ci NOT NULL, `Date` text COLLATE utf8_roman_ci NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_roman_ci AUTO_INCREMENT=6 ; -- Contenu de la table `Absence` INSERT INTO `Absence` (`ID`, `Num`, `Mois`, `Date`) VALUES (1, 1, '2015-02', 'du 6 au 19'), (2, 1, '2015-03', 'du 6 au 19'), (3, 3, '2015-02', 'du 15 au 22'), (4, 1, '2015-03', 'du 29 au 31'), (5, 3, '2015-03', 'du 1 au 8');
Num.Absence=ID.Bureau
Avec ces deux tables, je souhaiterais obtenir le tableau suivant*:
Prénom...│....Nom....│.2015-02..│......2015—03.......│2015-04 │etc...
Michelle..│.Perroquin.│..6 au 10.│.6 au 19 29 au 31.│.............│.............│
Michelle..│...Daniel...│.............│.........................│.............│.............│
Patricia...│.Retsinias.│.15 au 22.│........1 et 8........│ .............│.............│
François..│..Daniel...│..............│........................│.............│.............│
Martine...│...Gole... │..............│........................│.............│.............│
Isidore...│.Spasaro..│...............│........................│.............│.............│
Je pense que cela doit être possible avec la fonction GOUP_CONCAT(IF
Qui peut m'aider ?
* Merci *
Partager