title: Oracle Group by column inside subquery
body: <p>i'm working with a query in oracle, the query is returning the values properly. this is the query.</p>
  
  <pre><code>select max(ids) as IDTRX, monto, saldo, DE31, thekey, tipotrx
      from (select t.*,
           t.SID as ids,
           (TO_NUMBER(SUBSTR(P.P1204, 5, 12))) as monto,
           ((TO_NUMBER(SUBSTR(P.P1204, 5, 12)) * (TO_NUMBER(SUBSTR(t.EXTRA_INFO, 13,2)) - TO_NUMBER(SUBSTR(P.P1204, 3,2))))) as saldo,
           (TO_CHAR(t.DATE_TRX, 'YYMMDD') || t.AUTH_CODE || t.TRANSAC_AMOUNT || t.CARD_NUMBER) as thekey,
           t.EXTRA_INFO AS DE31,
           TO_NUMBER(SUBSTR(t.EXTRA_INFO, 12, 1)) as tipotrx
           from TBL_TRX t LEFT JOIN TBL_PRS P ON (t.SID = P.TRANSACT) 
           )t
           group by thekey, monto, saldo, DE31, tipotrx
           order by max(ids) desc;   
  </code></pre>
  
  <p>it'sworking and displays all the data</p>
  
  <p><a href="https://i.stack.imgur.com/Xtr5x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xtr5x.png" alt="enter image description here"></a></p>
  
  <p>How can i group the results that share the same "tipotrx", in the image is 6, how can i count all the rows that has 6 and group them?? </p>
  
  <p>i tried grouping by tipotrx but it shows everything.</p>