help with a query?


  • i have two tables 1st table has id,name 2nd tables has ipaddress

    for ex:

    tableID  -ID Primary Key         tableIPAddress--Forign key tableID on Colum ID

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

    id    name                              ID  IpAddress

    1    Abc                                 1

    2    def                                  2

    3    ijk                                   1  76.323.213.12

    i am trying to retrive all the columns in TableID and TableIpAddress that have IPaddress

    select ID,Name,I.IPAddress from TableID JOIN  TableIPAddress I ON  ID = I.ID.i get the below result

    ID      Name                   IPAddress          

    1        Abc             

    1        Abc                76.323.213.12

    2        def       

    is there anyway to write the Query so the result would look in the below format?

    ID           Name          IPAddress1       IPAddress2

    1             Abc      76.323.213.12        

    2                   def                        


    • Edited by LuckyDba Tuesday, July 23, 2013 9:53 PM
    Tuesday, July 23, 2013 9:51 PM


All replies