title: PSQL query to create table of relationships given purchases and churn tables
body: <p>my SQL-fu isn't what it used to be, so I thought I'd ask you wizards this.</p>
  
  <p>The (simplified) tables in question are:</p>
  
  <pre><code>Purchases
  - customer_id int
  - purchase_date timestamp
  
  Churns
  - customer_id int
  - churn_date timestamp
  
  Customers
  - id int
  </code></pre>
  
  <p>What I would like to end up with is a result set that looks like this:</p>
  
  <p><code>customer_id | first_purchase_in_relationship | churn_date (if applicable)</code></p>
  
  <p>The trick here is that customers can churn and then "reactivate" and make more purchases, so there may be multiple entries for a customer.</p>