SQL Server Performance

Repeat records depending field value

Discussion in 'SQL Server 2005 General Developer Questions' started by makis_best, Oct 22, 2014.

  1. makis_best New Member

    Hi all.

    I have a table called Names like this

    Number1 | Number2 | Number 3 | Name
    ==============================
    Null | 2 | 3 | John
    1 | Null | Null | Peter
    Null | 3 | Null | Bill

    And I want a result like this

    1 | Number2 | John
    2 | Number2 | John
    3 | Number3 | John
    4 | Number3 | John
    5 | Number3 | John
    6 | Number1 | Peter
    7 | Number2 | Bill
    8 | Number2 | Bill
    9 | Number2 | Bill

    How i can do that?

    Please help.
    Thank you.

Share This Page