locked
pivot on multiple tables RRS feed

  • Question

  • table1

    mobile remarks
    -----------------------------------------
    9923455599 number busy
    1234567890 invalid number
    9208438539 no response
    9923455599 no response

    table2

    mobile status empcode
    -----------------------------------------------------------
    9923455599 cold  101
    9208438539 warm  102
    1234567890 unable to contact  103
    9923455599                warm  104

    table3

    empcode agentname
    -------------------------------------
    101  xyz
    102  abc
    103  bcd
    104  def


    output:

    mobile           remark1       status1  agentname1          remark2   status2  agentname2     
    --------------------------------------------------------------------------------------------------------------------
    9923455599  number busy   cold               xyz              no response    warm        def
    9208438539  no response   warm           abc                 null                null        null
    1234567890  invalid no.  unable 2cntct     bcd                 null              null        null              please help me out in getting output in de above format

               
    • Moved by Tom Phillips Wednesday, May 16, 2012 2:28 PM TSQL question (From:SQL Server Database Engine)
    Tuesday, May 15, 2012 5:39 PM

Answers