title: NOT DISTINCT query in mySQL
body: <p>I have been asked to create a query for this on a simple employee database columns include:</p>
  
  <p>ninumber - first name - last name - address - SuperVisorNiNumber </p>
  
  <p>The employees and supervisors are all held in the same table and are referenced by their ninumbers. The query I've been asked to build is: </p>
  
  <p>v. Find the NI Numbers, first and last names of employees and NI numbers of supervisors where the employees share that supervisor and both employees and supervisors work in department 8. You will refer to the employee relation twice was done in query vi of Practical 2. Your results should be presented in columns with the following titles ‘Employee NI number’, ‘First Name’, ‘Last Name’ and ‘Supervisor NI Number’.</p>
  
  <p>Therefore I created this query: </p>
  
  <pre><code>SELECT e1.ninumber,
         e1.fname,
         e1.minit,
         e1.lname,
         e1.address,
         e1.superNiNumber,
         COUNT(*) AS nrOfOccurences
  FROM   employee AS e1,
         employee AS e2
  WHERE  e1.dno = 8
     AND e1.superNiNumber = e2.ninumber
     AND e2.dno = 8
  GROUP  BY e1.superNiNumber
  HAVING COUNT(*) &gt; 1
  </code></pre>
  
  <p>I couldn't do a not distinct query to work out this part of the question - "where the employees share that supervisor". This query returns a grouping of the rows which in turn hides some of the rows I want to show. </p>
  
  <p>My question is: Is my query correct for the question and can I do a NON DISTINCT query in mySQL to get the database to return all of the fields instead of grouping them together.</p>
  
  <p>Reutrn results from my query </p>
  
  <pre><code>NInumber    fname  minit    lname   address    supervisorNiNum     number of occerences
  666666601   Jill    J   Jarvis  6234 Lincoln, Antrim, UK    666666600   2
  666666607   Gerald  D   Small   122 Ball Street, Letterkenny, IRL   666666602   3
  666666604   Billie  J   King    556 WAshington, Antrim, UK  666666603   2
  </code></pre>
  
  <p>Thanks.</p>