title: Oracle: how to group by 1st value in row?
body: <p>Table has 3 columns in a table: ITEM, SUB_ITEM, DATE_CREATED.</p>
  
  <pre><code>ITEM - item id (string)
  SUB_ITEM - item id (int)
  DATE_CREATE - date the SUB_ITEM was created (date)
  </code></pre>
  
  <p>Scenario: </p>
  
  <ol>
  <li>There are 3 Different item's (AAA1, AAB2, ABB3)</li>
  <li>All 3 of these item's have multiple sub-items.</li>
  <li>Each item has a sub-item that is the same for each of them (eg. All 3 of the item's have a SUB_ITEM = 101010)</li>
  </ol>
  
  <p>I am trying to do something like:</p>
  
  <pre><code>select * 
  from table 
  group by ITEM, SUB_ITEM, DATE_CREATED
  </code></pre>
  
  <p>How do you make it display only 1 row? I don't care if it chooses AAA1 or AAB2 or ABB3, I just want it to pick 1 and remove the rest so it will show 1 row per SUB_ITEM, but still displays at least one of the parent items.</p>
  
  <p>Edit:</p>
  
  <p>Thank you to <strong>mathguy</strong> for answering the above question.</p>
  
  <p>Question 2:
  Is it possible to group by the 1st 2 letters of the item in addition to the sub_item? So instead of returning 1 row, return 2 rows: AAA1 and AAB2 will cascade in to 1 row, and ABB3 will be the 2nd row because 'AA' and 'AB' are different.</p>
  
  <p>Edit 2: See Main Answer comments for answer to question 2</p>