problem how to fusion 2 column

  • hello everybody

    this's my table

    ID | HT | Adresse1 | Adresse2

    ----------------------------------

    1 | 1 | AD | DS

    1 | 2 | BS | HG

    2 | 3 | XD | JH

    i need to have a in result like this in one column

    Result

    -----

    AD

    BS

    DS

    Hg

    ------

    thanks

  • This should do the trick:

    DECLARE @test-2 TABLE (

    D int,

    HT int,

    Adresse1 char(2),

    Adresse2 char(2)

    )

    INSERT INTO @test-2 VALUES (1,1,'AD','DS')

    INSERT INTO @test-2 VALUES (1,2,'BS','HG')

    INSERT INTO @test-2 VALUES (1,3,'XD','JH')

    SELECT address

    FROM @test-2 AS T

    UNPIVOT (address FOR addresses IN (Adresse1,Adresse2)) AS U

    Hope this helps

    Gianluca

    -- Gianluca Sartori

  • thanks

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

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