Changing the Order form of a table.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phanikumar32
    New Member
    • Apr 2014
    • 22

    Changing the Order form of a table.

    Hello all,
    I have a table in sql server.The Layout is as below.(image1)


    And i want the output as like below.(image2).

    Please guide me,how can i do for this.

    Thanks In Advance,
    Phani Kumar.
    Attached Files
  • anvidc
    New Member
    • Sep 2007
    • 28

    #2
    Hi,

    You can use UNION query:

    Code:
    SELECT Table1.Name, Table1.PhoneCell as Phone
    FROM Table1
    WHERE (((Table1.PhoneCell) Is Not Null))
    
    UNION ALL
    
    SELECT Table1.Name, Table1.PhoneOffice As Phone
    FROM Table1
    WHERE (((Table1.PhoneOffice) Is Not Null));

    Comment

    Working...