title: Replace NULL column after SQL UNION
body: <p>I am using a UNION to combine the results of two select statements. In one statement I find the <code>identity</code> of a <code>sender</code> and in the other I find the <code>identity</code> of a <code>recipient</code>. The problem I'm running into is that my row count is always twice what it "should" be as there will always be a "blank" <code>sender</code> for the recipient results and a "blank" <code>recipient</code> for sender results. How can I restructure this to return one row for each transaction which has both <code>sender</code> and <code>recipient</code> filled in?</p>
  
  <pre><code>(
    SELECT s.id, s.sender_id, '' AS sender, NOW() AS sender_create_date, s.recipient_id,
      MAX(c.identity) AS recipient, MAX(c.create_date) AS recipient_create_date
    FROM db.sales s
    LEFT JOIN db.customers c ON c.participant_id = s.recipient_id
    WHERE sender_id = $1
    OR recipient_id = $1
    GROUP BY s.id
  )
  UNION
  (
    SELECT s.id, MAX(c.identity) AS sender, MAX(c.create_date) AS sender_create_date, s.recipient_id,
      '' AS recipient, NOW() AS recipient_create_date
    FROM db.sales s
    LEFT JOIN db.customers c ON c.participant_id = s.recipient_id
    WHERE sender_id = $1
    OR recipient_id = $1
    GROUP BY s.id
  )
  </code></pre>
  
  <p>Here is an example of my current results for one transaction:</p>
  
  <pre><code>id | sender | sender_create_date | recipient | recipient_create_date
  1  |  bob   |     11/1/2016      |           |    11/22/2016
  1  |        |     11/22/2016     |    jill   |    11/5/2016
  </code></pre>
  
  <p>What I am aiming for is:</p>
  
  <pre><code>id | sender | sender_create_date | recipient | recipient_create_date
  1  |  bob   |     11/1/2016      |   jill    |    11/5/2016
  </code></pre>