Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007

    Unanswered: stuck in query..

    hey guys this is the structure of the Db:

    `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 basically N_Etudiant is a student name..

    so when we insert it looks like

    `N_Etudiant` Mike
    `Professeur` mrpopins
    `Foyer` 301
    `Motif` fight
    `Date` 2011/01/01
    `Notes` none
    `Autre` 0

    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

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    use GROUP BY and HAVING COUNT(*) > 2 | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts