Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: SQL Issue

  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL Issue

    I use sql analyzer from Microsoft....

    here is what I need help with


    Loan number....................Call type
    123456................................120
    123456................................118


    I need a way to show this


    Loan Number......Type1......Type2
    1233456..............120..........118


    How ?

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    How about maybe showing us the query too?
    OracleGuy

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    select   a.CALACTa.CALDATa.CALTIMa.calopra.CALLOGa.caltyp
    into  
    #POACallDocCodes
    from   Contact.dbo.phnlog as a
    WHERE   a
    .CALACT >0
    AND   a.CALDAT BETWEEN '6/1/2006' and '6/30/2006'
    AND   a.CALLOG IN ('C','T')
    group by a.CALACTa.CALDATa.CALTIMa.calopra.CALLOGa.caltyp
     
    select  a
    .CALACTa.CALDATa.CALTIMa.calopra.CALLOGa.caltypb.doccode
    into  
    #docCodeDataHolderCodes
    from  #POACallDocCodes as a
    left join  CSRReporting.dbo.CSSDLOGF01 as b
    on   
    (a.CALACT=b.docacct#) and (a.CALDAT=b.docdate) and (a.calopr=b.docusrid)
    where   b.doccode IN ('116''200''208''508''130''72''564''565')

    select   a.CALACTa.CALDATa.CALTIMa.CALLOGa.CALTYPa.doccodeb.txtdsc
    from   
    #docCodeDataHolderCodes as a
    left join  DEV.dbo.QC_CCS0100F03 as B
    on   
    (a.doccode=b.txtcode)
    group by  a.CALACTa.CALDATa.CALTIMa.caltypa.CALLOGa.doccodeb.txtdsc 

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    O dont know how to incorporate this into your query, but i have done this once by a join to the table itself:

    Code:
    SELECT T1.loannumber As [Loan number], T1.calltype As [Type 1], T2.calltype As [Type 2]
    FROM tablename T1
    INNER JOIN tablename T2
    ON T2.loannumber = T1.loannumber
    I am the luckiest man in the world


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •