title: Sql get MAX for other value
body: <p>I would like to figure out how to select a table where the value is the ID of the person with the highest pay.</p>
  
  <p>So if I had</p>
  
  <p>Table=theJobs </p>
  
  <pre><code>JobID  Pay
  ----------
  12345  10  
  12346  12  
  12347  13
  </code></pre>
  
  <p>table=thePerson  </p>
  
  <pre><code>Person   JobID   
  --------------
  Person1  1  
  Person2  2  
  Person3  3
  </code></pre>
  
  <p>table=hire(FKs)  </p>
  
  <pre><code>JobID  PersonID
  ----------------
  12345  2  
  12347  1  
  12346  3
  </code></pre>
  
  <p>I'd like it to show the max payed person so it should show  </p>
  
  <pre><code>Person1
  </code></pre>
  
  <p>I tried to use where for the a Max function but it seems to fail. I'm pretty sucky at these group functions. I guess I'm more asking how to use a group function as a constraint than anything. Since I had a similar issue a bit ago. </p>