title: Extract Max and Min values of a column from a table in the same row
body: <p>Suppose I have the following table:</p>
  
  <pre><code>ID  Bag Event       Count   Driver  Time
  1   XYZ Pick-up     10      A1      10:30 AM
  2   XYZ Trnsfr-out  10      A1      10:40 AM
  3   XYZ Trnsfr-in   10      A2      10:40 AM
  4   XYZ Drop        10      A2      10:50 AM
  5   ABC Pick-up     10      B1      10:30 AM
  6   ABC Trnsfr-out  10      B1      10:40 AM
  7   ABC Trnsfr-in   10      B2      10:40 AM
  8   ABC Trnsfr-out  10      B2      10:50 AM
  </code></pre>
  
  <p>Is there anyway I can get Drivers for MAX(ID) and MIN(ID) for a particular bag using the same query?</p>
  
  <p>I have the following query now:</p>
  
  <pre><code>Select Bag, Count, Driver as FinalDriver,TIME from Bagtable where ID in  (Select Max(ID) from Bagtable Group By Bag)
  </code></pre>
  
  <p>The Result is</p>
  
  <pre><code>Bag Count   FinalDriver TIME
  XYZ 10      A2          10:50 AM
  ABC 10      B2          10:50 AM
  </code></pre>
  
  <p>I want the result to looks something like this:
  The values for Initial driver should be obtained by using the min(ID) for a specific bag.</p>
  
  <pre><code>Bag Count   InitialDriver   FinalDriver TIME
  XYZ 10      A1              A2          10:50 AM
  ABC 10      B1              B2          10:50 AM
  </code></pre>
  
  <p>Kindly help me with the SQL for the above. Thanks</p>