title: Select Distinct Rows with complex criteria
body: <p>I have a table generated from a CRM software and it has a lot of repited individuals in different rows but with different fields completed in each repetition, something like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">id</th>
  <th style="text-align: center;">birth_date</th>
  <th style="text-align: center;">sex</th>
  <th style="text-align: center;">postal_code</th>
  <th style="text-align: center;">customer</th>
  <th style="text-align: center;">smoker</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">001</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">00067</td>
  <td style="text-align: center;">Yes</td>
  <td style="text-align: center;">1</td>
  </tr>
  <tr>
  <td style="text-align: center;">001</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">Male</td>
  <td style="text-align: center;">00067</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">1</td>
  </tr>
  <tr>
  <td style="text-align: center;">001</td>
  <td style="text-align: center;">21/03/1994</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">00067</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  </tr>
  <tr>
  <td style="text-align: center;">002</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">Female</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  </tr>
  <tr>
  <td style="text-align: center;">002</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">09986</td>
  <td style="text-align: center;">No</td>
  <td style="text-align: center;">0</td>
  </tr>
  <tr>
  <td style="text-align: center;">003</td>
  <td style="text-align: center;">13/01/1986</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">No</td>
  <td style="text-align: center;">1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The desired table extracted from this one should be this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">id</th>
  <th style="text-align: center;">birth_date</th>
  <th style="text-align: center;">sex</th>
  <th style="text-align: center;">postal_code</th>
  <th style="text-align: center;">customer</th>
  <th style="text-align: center;">smoker</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">001</td>
  <td style="text-align: center;">21/03/1994</td>
  <td style="text-align: center;">Male</td>
  <td style="text-align: center;">00067</td>
  <td style="text-align: center;">Yes</td>
  <td style="text-align: center;">1</td>
  </tr>
  <tr>
  <td style="text-align: center;">002</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">Female</td>
  <td style="text-align: center;">09986</td>
  <td style="text-align: center;">No</td>
  <td style="text-align: center;">0</td>
  </tr>
  <tr>
  <td style="text-align: center;">003</td>
  <td style="text-align: center;">13/01/1986</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: center;">No</td>
  <td style="text-align: center;">1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>So as you can see, there are some columns completed in some repetitions, so the idea is to avoid repetitions (here we see a repetition because there's the same id for more than one row, the id column should be the primary key) and get the maximum information about that id.</p>
  <p>Any idea of how to achieve that?</p>