title: Grouping multile SQL results by a given field
body: <p>How can I group the results of the following query by employee?</p>
  
  <p>OK so I have three tables:
  1. company_employee which contains an employee id (company_employee.employee) mapped to a company id (company.id). it also contains an employee role</p>
  
  <ol start="2">
  <li><p>employee which contains employee first name, last name</p></li>
  <li><p>company which contains an id, and a name</p></li>
  </ol>
  
  <p>Right now I am retrieving all the employees with a certain role, but I get multiple entries for the same employee with a different company mapping. something like this:
  My query is:</p>
  
  <pre><code>SELECT company_employee.employee, company_employee.company, employee.fname, employee.lname, company.name
   FROM company_employee
   JOIN employee on employee.id = company_employee.employee
   JOIN company on company.id = company_employee.company
   WHERE company_employee.role= 185;
  </code></pre>
  
  <p>My results are:</p>
  
  <pre><code>company_employee.employee     company_employee.company     employee.fname     employee.lname    company.name
  111                           100                          John               Smith             Super Candy
  111                           101                          John               Smith             Red Ballons
  222                           102                          Kevin              Lora              Super Computers
  111                           103                          John               Smith             Star Events
  222                           104                          Kevin              Lora              Vintage Pencils
  333                           105                          Margarett          Bush              Top Security
  </code></pre>
  
  <p>What I want to get is a listing of this sort:</p>
  
  <pre><code>Employee 111 John Smith mapped to a list of companies (100, 101, 103)
  Employee 222 Kevin Lora mapped to a list of companies (102, 104)
  Employee 333 Margarett Bush mapped to a list of companies (105)
  </code></pre>
  
  <p>Is this possible?</p>