Je voudrai recuperer le coefiicent des eleves selon leur serie pour pouvoir generer un bulletin de note depuis php.

Voici les tables en liaison
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
`eleve` (
  `idEleve` int(11) NOT NULL AUTO_INCREMENT,
  `prenom_eleve` text NOT NULL,
  `nom_eleve` text NOT NULL,
  `serie_eleve` varchar(10) NOT NULL,
  `classe_eleve` varchar(10) NOT NULL,
  `idParent` int(5) NOT NULL,
  `sexe` varchar(2) DEFAULT NULL,
  `telEleve` varchar(12) DEFAULT NULL,
  `mailEleve` varchar(10) DEFAULT NULL,
  `dateInscription` date DEFAULT NULL,
  `dateNaissance` date DEFAULT NULL,
  `lieuNaissance` varchar(10) DEFAULT NULL,
  `nationalite` varchar(10) DEFAULT NULL,
  `password` varchar(10) DEFAULT NULL,
  `session` varchar(10) DEFAULT NULL,
  `photo` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`idEleve`),
  UNIQUE KEY `classe_eleve` (`classe_eleve`),
  UNIQUE KEY `idEleve` (`idEleve`),
  KEY `idParent` (`idParent`),
  KEY `serie_eleve` (`serie_eleve`),
  CONSTRAINT `classe_eleve` FOREIGN KEY (`classe_eleve`) REFERENCES `classe` (`classe`),
  CONSTRAINT `idParent` FOREIGN KEY (`idParent`) REFERENCES `parent` (`id_parent`),
  CONSTRAINT `serie_eleve` FOREIGN KEY (`serie_eleve`) REFERENCES `serie` (`nom_Serie`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
 
`notes` (
  `idNote` int(11) NOT NULL AUTO_INCREMENT,
  `eleve` int(11) NOT NULL,
  `matiere` varchar(10) NOT NULL,
  `note1` float DEFAULT NULL,
  `note2` float DEFAULT NULL,
  `note3` float DEFAULT NULL,
  `compo1` float DEFAULT NULL,
  `semestre1` float DEFAULT NULL,
  `note4` float DEFAULT NULL,
  `note5` float DEFAULT NULL,
  `note6` float DEFAULT NULL,
  `compo2` float DEFAULT NULL,
  `semestre2` float DEFAULT NULL,
  PRIMARY KEY (`idNote`),
  KEY `eleve` (`eleve`),
  KEY `matiere` (`matiere`),
  CONSTRAINT `eleve` FOREIGN KEY (`eleve`) REFERENCES `eleve` (`idEleve`),
  CONSTRAINT `matieren` FOREIGN KEY (`matiere`) REFERENCES `matiere` (`nom_matiere`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
 
`coeficient` (
  `coef` int(11) NOT NULL,
  `matiere` varchar(10) NOT NULL,
  `serie` varchar(10) NOT NULL,
  `idcoef` int(5) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`idcoef`),
  KEY `matiere` (`matiere`),
  KEY `serie` (`serie`),
  CONSTRAINT `matiere` FOREIGN KEY (`matiere`) REFERENCES `matiere` (`nom_matiere`),
  CONSTRAINT `serie` FOREIGN KEY (`serie`) REFERENCES `serie` (`nom_Serie`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;

Voici la requete
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
id=$_GET['id'];
$req=mysql_query("SELECT  idEleve,notes.matiere,note1,note2,note3,compo1,coef
	FROM notes,eleve,coeficient,serie WHERE
	idEleve='$id' and eleve.idEleve=notes.eleve and coeficient.matiere=notes.matiere and eleve.serie_eleve=coeficient.serie")
	or die ('Error '.mysql_error());
dans ce cas de figure je peux recuperer les coefficients mais les matières sont en double sauf la premiere
et si j'ajoute GROUP by matiere les matières ne sont plus doublées mais la première matière disparait