title: Forced to use a sub-select, returning the latest
body: <p>This is a newb question, but I have always had a block on sub queries.  I normally just use CTEs, but this question was on a test I took a few days ago, and I was required to use a sub-select.</p>
  
  <p>Table is called CALL_DETAILS
  Columns:</p>
  
  <pre><code>PHONE_NBR (Phone number)
  CUSTOMER  (name)
  CALL_TYPE (cell or land)
  CALL_TIME (date and time of call)
  DURATION  (number of minutes)
  COST  (monetary)
  </code></pre>
  
  <p>Question on test:  "Now that you can find the records for each Customer and each CALL_TYPE that have the latest CALL_TIME How do you return all information from the CALL_DETAILS table for those rows?  Yes, we're looking for you to use a nested SELECT (sub-select) in this answer."</p>
  
  <p>I wrote the following, but have been second-guessing myself ever since.</p>
  
  <pre><code>SELECT
  PHONE_NBR
  ,CUSTOMER
  ,CALL_TYPE
  ,CALL_TIME
  ,DURATION
  ,COST
  FROM CALL_DETAILS CD
  WHERE CALL_TIME IN
     (SELECT MAX(CALL_TIME)
      FROM CALL_DETAILS CDS
      GROUP BY CUSTOMER, CALL_TIME)
      ;
  </code></pre>
  
  <p>Was this correct??</p>