title: MySQL query to find employees salary greater than any manager
body: <p>So, I have this schema:</p>
  
  <pre><code>Emp(eid: integer,ename: string,age: integer,salary: real)
  Works(eid:integer,did: integer,pct_time: integer)
  Dept(did:integer,budget: real,managerid:integer)
  </code></pre>
  
  <p>I want to return the employees whose salary is greater that any manager (regardless of their department).  </p>
  
  <pre><code>select E.ename, D.did, E.eid
  from Emp E
  join Works W ON E.eid = W.eid
  join Dept D ON D.did = W.did
  where E.salary &gt; (select E2.salary from Emp E2, Dept D2 
                  where E2.eid = D2.managerid)
  </code></pre>
  
  <p>But the sub query statement is returning more than one row. How can I compare multiple rows from 2 tables to get the correct result? Grouping should work, right?</p>