title: SQL get MAX() value of values in a list
body: <p>i have a database of transactions between customers that can be described as in:</p>
  
  <pre><code>Transaction ID  Sender  Receiver    Sender  Receiver Receipt
  1   A   B   2   4
  2   C   A   5   1
  3   B   C   5   1
  4   C   B   3   4
  </code></pre>
  
  <p>database is sorted ascending by transaction id; how is it possible to get the last receipt number (sender or receiver) for each customer</p>
  
  <p>for example
  A:1  (the last occurrence of A is in row 2 as a sender)
  B:4  (the last occurrence of B is in row 4 as a Receiver)
  C:3  (the last occurrence of C is in row 4 as a sender)</p>
  
  <p>Thank You,</p>