title: How to select one email per record
body: <p>Can anyone help me how to select one record per email?</p>
  
  <p>I have the query below:</p>
  
  <pre><code>SELECT a.ID, a.NAME, a.LASTMODIFIED, b.EMAIL
  FROM TABLE_A a
  JOIN TABLE_B b
  ON a.IDA = b.IDB
  WHERE a.LASTMODIFIED &lt;= today
  ORDER BY b.LASTMODIFIED
  </code></pre>
  
  <p>it will result :</p>
  
  <pre><code>+------+-------+--------------------------------------+
  | id   | name   | lastmodified      | email           |
  +------+-------+--------------------------------------+
  | 1    | aa     | 01-JAN-2016       | test01@mail.com |
  | 2    | bb     | 02-JAN-2016       | test02@mail.com |
  | 3    | cc     | 03-JAN-2016       | test01@mail.com |
  | 4    | dd     | 02-JAn-2016       | test03@mail.com |
  +------+-------+--------------------------------------+
  </code></pre>
  
  <p>expected result is :</p>
  
  <pre><code>+------+-------+--------------------------------------+
  | id   | name  | lastmodified       | email           |
  +------+-------+--------------------------------------+
  | 2    | bb    | 02-JAN-2016        | test02@mail.com |
  | 3    | cc    | 03-JAN-2016        | test01@mail.com |
  | 4    | dd    | 02-JAN-2016        | test03@mail.com |
  +------+-------+--------------------------------------+
  </code></pre>
  
  <p>It should return only one email per row, order by <code>lastmodified</code> date.</p>