How to get value portion key to every rn from 1 to 3 row on one row?

  • I need to get value portion key to every 3 row on one row meaning

    rn 1,2,3 one row KRM__21X0E100C0ADD

    rn 1,2,3 one row KRM__21X0J100K0ADD

    rn 1,2,3 on one row KRM__21X1C100D0ADD

    create table #portiontableFinal
    (
    rn int,
    ValuePortionKey nvarchar(100)
    )
    insert into #portiontableFinal(rn,ValuePortionKey)
    values
    (1,'KRM__21X0E100'),
    (2,'C0AD'),
    (3,'D'),
    (1,'KRM__21X0J100'),
    (2,'K0AD'),
    (3,'D'),
    (1,'KRM__21X1C100'),
    (2,'D0AD'),
    (3,'D')
    RNValuePortionKey
    1KRM__21X0E100
    2C0AD
    3D
    1KRM__21X0J100
    2K0AD
    3D
    1KRM__21X1C100
    2D0AD
    3D

    I need to get from 1 to 3 on one rows as following :

    final result I need to get as below :

    KRM__21X0E100C0ADD

    KRM__21X0J100K0ADD

    KRM__21X1C100D0ADD

  • You have nothing that binds the 3 records together and nothing that orders the records.  So there is no way to consistently achieve what you are trying to do.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply