title: Finding the "exotic" value in a MySQL table
body: <p>I have a MySQL table called <code>accounts</code>. Within this table is a field called <code>salesmanager_id</code>. 99% of the time, the value in this field is always the same for all accounts of a specific customer (specified with <code>customer_id</code>).</p>
  
  <p>What I'm trying to do is find the <code>customer_id</code> for the customers that have accounts assigned to more than one salesmanager. For example:</p>
  
  <pre><code>+------------------------------------+
  | id | customer_id | salesmanager_id |
  |------------------------------------|
  | 1  | 12          | 4               |
  | 2  | 12          | 4               |
  | 3  | 14          | 3               | &lt;-- I want this customer_id
  | 4  | 14          | 4               |
  +------------------------------------+
  </code></pre>
  
  <p>In the above example, <code>customer_id</code> 14 has both <code>salesmanager_id</code> 3 and 4 assigned to it. I would like to retrieve that <code>customer_id</code> for my list.</p>
  
  <p>I tried the following query, but that returns an empty result (while I'm sure there are at least some differences).</p>
  
  <pre><code>SELECT `name`, `customer_id` AS `customer`, `salesmanager_id` FROM `accounts`
  WHERE `salesmanager_id` NOT IN (
      SELECT `salesmanager_id` FROM `accounts` a
      LEFT JOIN `customers` c ON (a.customer_id = c.id)
      WHERE a.customer_id=c.id
  ) GROUP BY `customer`;
  </code></pre>