title: Syntax for SQL Grouping or subquery with reverse sorted dataset needing single string values not numeric summary?
body: <p>Lets say I have a table that looks something like this:</p>
  
  <p>ProjectSts:</p>
  
  <pre><code>ID   Proj  Status  LogDate    FundsRemain  LogBy
  60   2     Quit    1/5/2013   Yes          QOVM
  59   2     Quit    1/4/2013   Yes          YZYO
  58   2     Quit    1/3/2013   No           XYZ
  54   2     Start   1/1/2013   NA           QOVM
  50   1     Quit    12/2/2012  Yes          UUOI
  48   1     Quit    12/1/2012  Yes          OIJP
  </code></pre>
  
  <p>Currently what I am doing is a SQL statement to <code>SELECT * FROM  ProjSts WHERE Status = 'Quit' AND FundsRemain = 'Yes'</code>.  Then, within another application I am having the application manually read through all the resulting project status entries and select the chronologically first (earliest) such status for each project so it can be exported to a new table.</p>
  
  <p>What I am wondering is how, if it's possible, to get this to happen all within the SQL statement.  I've looked at a lot of the tutorials on SQL Group By and they all show what to do if I wanted to sum, average, etc... a numeric field for all the entries for each project.  And I've looked at some tutorials on subqueries that show me how to generate an IN list, but I've not seen anything that would generate just a list of the post-sorted first record that meets certain criteria for each unique value within another field.</p>
  
  <p>Ideally, from the example data above, the result would be:</p>
  
  <pre><code>ID   Proj  Status  LogDate    FundsRemain  LogBy
  48   1     Quit    12/1/2012  Yes          OIJP
  59   2     Quit    1/4/2013   Yes          YZYO
  </code></pre>
  
  <p>Sorry, I'm not the most advanced SQL user, but this would be great if I could get it to run within the SQL instead of having to rely on an external application to then go back and re-process the select results just to select what I actually need out of it.</p>
  
  <p>Any help would be appreciated (PS: this is from a ctree database and I am currently using crystal reports 2008 for the initial data-extract)</p>