title: Merging records based on a priority field
body: <p>I have a table with people's demographic information that has been compiled from multiple sources.  As a result, some people have duplicate records (based on their identifier) with differing data in other fields.  I've added a record_authority field that lists the row's priority based on its original source.  This is what it looks like:</p>
  
  <pre><code>record_authority    identifier    lastname    firstname    dob
  1                   1234          Doe         William      1/1/2000
  3                   1234          Doe         Bill         1/1/2000
  2                   5678          Smith       Jane         NULL
  3                   5678          Smith       Jane         1/1/1990
  1                   9999          Brown       John         NULL
  4                   9999          Brown       John         NULL
  </code></pre>
  
  <p>And here is what I'm trying to end up with.  NULL values should be replaced with the highest priority non-NULL value, when available.</p>
  
  <pre><code>identifier    lastname    firstname    dob
  1234          Doe         William      1/1/2000
  5678          Smith       Jane         1/1/1990
  9999          Brown       John         NULL
  </code></pre>
  
  <p>Any help is greatly appreciated!</p>