• Hello,

    I have added to declare table:

    declare @info table ( nr int, [address] varchar(100), alias varchar(100))

    INSERT INTO @info (nr, [address],alias)

    Select 1,'x1@yahoo.com','X1@exc.yahoo.ex'

    union all

    Select 2,'X2@gmail.com','X2@exc.gmail.ex,X3@exc.bcm.ex'

    union all

    Select 3,'X4@gmail.com','X4@exc.gmail.ex,X5@exc.bbx.ex,X6@exc.bbx.ex'

    union all

    Select 4, 'X7@co.com', 'X8@exc.gmail.ex,X2@exc.yahoo.ex,X10@exc.coo.ex'

    union all

    Select 5,'X11@x.com', 'X11@exc.x.ex'

    union all

    Select 6,'X12@nor.com','X12@exc.nor.ex,X13@exc.nor.ex'

    I would like get this result:

    declare @result table ( nr int, [address] varchar(100), alias varchar(100))

    INSERT INTO @result (nr, [address],alias)

    Select 1,'', ''

    union all

    Select 2,'X2@gmail.com','X3@exc.bcm.ex'

    union all

    Select 3,'X4@gmail.com','X5@exc.bbx.ex,X6@exc.bbx.ex'

    union all

    Select 4,'X7@co.com','X8@exc.gmail.ex,X2@exc.yahoo.ex,X10@exc.coo.ex'

    union all

    Select 5,'',''

    union all

    Select 6,'X12@nor.com','X13@exc.nor.ex'

    Select * from @result

    What should I use a query for this result?