title: In SQL in a "group by" expression: how to get the string that occurs most often in a group?
body: <p>Assume we have the following table:</p>
  
  <pre><code>Id   A    B
  1    10   ABC
  2    10   ABC
  3    10   FFF
  4    20   HHH
  </code></pre>
  
  <p>As result of a "group by A" expression I want to have the value of the B-Column that occurs most often:</p>
  
  <pre><code>select A, mostoften(B) from table group by A;
  
  A    mostoften(B)
  10   ABC
  20   HHH
  </code></pre>
  
  <p>How do I achieve this in Oracle 10g?</p>
  
  <p><strong>Remark:</strong> in the case of a tie (when there are more than one value that occurs most often) it does not matter which value is selected.</p>