title: Create PostgreSQL table specifying different query specification of each unique ID
body: <p>Following is an example of a data tables for a database.</p>
  
  <p>Encounter table: Columns: encounterid , patientid, admit_date, discharge_date
  Patient table: patient_id, unique_patient_id</p>
  
  <p>I have selected a specific group of patients and identified unique ids associated with those patients based on specific criteria, let's say this is encounter 1.</p>
  
  <p>Each of these unique patients has further encounters with the system. I want to collect all of the future encounters past the discharge date but within 1 year from the discharge period. </p>
  
  <p>Lets say my selected ids and dates are listed as following:</p>
  
  <pre><code>unique_id date_discharge date_discharge_365
  1           d_dt1           f_dt1
  2           d_dt2           f_dt2
  .            .                .
  .            .                .
  n            d_dtn           f_dtm
  </code></pre>
  
  <p>How do I select all of the specific encounters for each of those ids from the encounter table based on specific selection criteria for each of the ids?</p>