#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    5
    Rep Power
    0

    Wanted SlNo for different name.....


    Select Name, Sal From
    (Select 'A' Name, 1 Sal From Dual
    Union
    Select 'A' Name, 2 Sal From Dual
    Union
    Select 'A' Name, 3 Sal From Dual
    Union
    Select 'B' Name, 11 Sal From Dual
    Union
    Select 'C' Name, 111 Sal From Dual
    Union
    Select 'C' Name, 222 Sal From Dual
    Union
    Select 'D' Name, 1111 Sal From Dual
    Union
    Select 'D' Name, 2222 Sal From Dual
    Union
    Select 'D' Name, 3333 Sal From Dual
    Union
    Select 'D' Name, 4444 Sal From Dual
    Union
    Select 'D' Name, 5555 Sal From Dual)

    which will return output like

    Name SAL
    ---- ----------
    A 1
    A 2
    A 3
    B 11
    C 111
    C 222
    D 1111
    D 2222
    D 3333
    D 4444
    D 5555

    I want one more column which will display no. for each name like

    No Name SAL
    -- ---- ----------
    1 A 1
    1 A 2
    1 A 3
    2 B 11
    3 C 111
    3 C 222
    4 D 1111
    4 D 2222
    4 D 3333
    4 D 4444
    4 D 5555


    can anyone help me

    thanx in advance

    vijay
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    64
    Rep Power
    11
    Select rownum,Name, Sal From
    (Select 'A' Name, 1 Sal From Dual
    Union
    Select 'A' Name, 2 Sal From Dual
    Union
    Select 'A' Name, 3 Sal From Dual
    Union
    Select 'B' Name, 11 Sal From Dual
    Union
    Select 'C' Name, 111 Sal From Dual
    Union
    Select 'C' Name, 222 Sal From Dual
    Union
    Select 'D' Name, 1111 Sal From Dual
    Union
    Select 'D' Name, 2222 Sal From Dual
    Union
    Select 'D' Name, 3333 Sal From Dual
    Union
    Select 'D' Name, 4444 Sal From Dual
    Union
    Select 'D' Name, 5555 Sal From Dual)
    /

IMN logo majestic logo threadwatch logo seochat tools logo