`Ex_ID` int(11) NOT NULL auto_increment,
`N_Etudiant` varchar(25) NOT NULL,
`Professeur` varchar(50) NOT NULL,
`Foyer` varchar(50) NOT NULL,
`Motif` varchar(50) NOT NULL,
`Date` date NOT NULL,
`Notes` text NOT NULL,
`Autre` varchar(150) NOT NULL,
so the query i need is to flag if (N_Etudiant) has the same (Professeur) more the 2 times
cause we need to know if the student (N_Etudiant) has been expelled from class by the same teacher (Professeur) more then 2 times..
is this clear?lol
3
Contributors
3
Replies
1 Day
Discussion Span
1 Year Ago
Last Updated
4
Views
Related Article:Query Trouble
is a MySQL discussion thread by Shephard that has 3 replies, was last updated 2 years ago and has been tagged with the keywords: mysql, query.
SELECT `Foyer`,
SUM(IF(`Professeur` = "mrpopins", 1,0)) AS `count`
FROM student_table
WHERE `N_Etudiant` = 'Mike'
GROUP BY `N_Etudiant`
ORDER BY count DESC