title: SQL Select Max ID Where Condition Is Met
body: <p>I have a table with 50-100k rows.  I have an auto-increment ID field, and another field called Main_Port.</p>
  
  <p>I want to select the last ID where Main_Port = x.  And I want it to be efficient.</p>
  
  <p>What I'm using right now is:</p>
  
  <pre><code>SELECT max(MANIFEST_ID)FROM MANIFEST_MSS.dbo.Manifest where Main_Port = x
  </code></pre>
  
  <p>Is this the best way to do it?</p>
  
  <p>The table has potential to grow to 500k+ rows</p>