about oracle SQL query need to skip the repeated value in one column -


i have data in table this:

custid  custname 10      tony 10      jony 10      hony 20      bot 20      guly 20      easter 

i need output below:

custid custname 10     tony        jony        hony 20     bot        guly        easter 

try following.

with src  (select 10 custid, 'tony' custname     dual   union   select 10, 'jony'     dual   union   select 10, 'hony'     dual   union   select 20, 'bot'     dual   union   select 20, 'guly'     dual   union   select 20, 'easter'     dual)  select case           when rnum = 1            custid        end custid, custname   (select row_number() over(partition custid order custid) rnum,                 src. custid, src. custname            src) 

here i've used row_number() analytic function


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -