title: Group by using Analytical function Oracle
body: <p>I have the below demo code.
  How can I get the desired output.Its just not coming in my mind :-(.It has to be a simple change.</p>
  
  <pre><code>WITH Abc  AS (SELECT 'AB' AS code,'Z12' AS des, 123 AS tk FROM dual UNION
  SELECT 'AB','Z14',234 FROM dual UNION
  SELECT 'ACB','D12',34 FROM dual UNION
  SELECT 'ACB','D12',36 FROM dual UNION
  SELECT 'ACB','F12',35 FROM dual UNION
  SELECT 'ABX','G44',243 FROM dual UNION
  SELECT 'ABX','H44',654 FROM dual UNION
  SELECT 'ABX','J12',534 FROM dual UNION
  SELECT 'ABQ',NULL,356 FROM dual)
  
  SELECT DISTINCT tk,code,des ,code||'_'||row_number () OVER (PARTITION BY code ORDER BY code,des ) AS str FROM abc
  ORDER BY 2,3;
  </code></pre>
  
  <p>OUTPUT :</p>
  
  <pre><code> tk code des str
  --- --- --- ---
  123 AB  Z12 AB_1
  234 AB  Z14 AB_2
  356 ABQ     ABQ_1
  243 ABX G44 ABX_1
  654 ABX H44 ABX_2
  534 ABX J12 ABX_3
  34  ACB D12 ACB_1  ---  ACB_1
  36  ACB D12 ACB_2  ----I want ACB_1 here too since desc is same for that code
  35  ACB F12 ACB_3
  </code></pre>