none
help with a query?

    Question

  • 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  156.3.23.23

    2    def                                  2  212.34.23.43

    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                      156.3.23.23 

    1        Abc                76.323.213.12

    2        def                 212.34.23.43

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

    ID           Name          IPAddress1       IPAddress2

    1             Abc             156.3.23.23   76.323.213.12        

    2                   def                   212.34.23.43               

    lucky






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

Answers

All replies