title: MySQL - SELECT query - oldest and youngest date
body: <p>I have to build one SQL SELECT query. Table structure is as follows:</p>
  
  <pre><code>[ID] [PHONE] [description] [DATE]
  [1] [600898367] [main] [2016-01-23]
  [2] [600898367] [] [2016-01-24]
  [3] [600898367] [] [2016-01-26]
  [4] [600898367] [] [2016-01-28]
  [5] [662349093] [main] [2016-01-10]
  [6] [662349093] [] [2016-01-21]
  [7] [662349093] [] [2016-01-30]
  [8] [662349093] [] [2016-01-31] 
  </code></pre>
  
  <p>You have here different records grouped within the same telephone number. The first (the oldest) occurance is marked with [main] flag. There's no two identical numbers with [main] flag. 
  I want to select each [main] record and additionaly one youngest with the same phone number, so the result should give records 1,4,5,8.</p>
  
  <p>Please help.</p>