• thermanson (8/27/2012)


    I haven't tested this since there was no test data supplied, but I think this should work.

    Insert into MergeTable (Project number, IsProjNumConverted)

    Select Coalesce(x.proj_id,i.proj_id) as projID,

    Case

    When x.proj_id is not null then 1

    else 0

    End Converted

    FROM dbo.Incident_Info i

    left outer join Repository.dbo.PROJ_ID_XREF x on x.PROJ_ID=i.Proj_ID

    Hi,

    The query is working fine, But i need to display the project number even though there is no match found with project id in table b. The result set is coming like below when i execute your query,

    01779.124.034Yes

    12682.004.006Yes

    NULLNo

    12682.004.006Yes

    NULLNo

    NULLNo

    NULLNo

    NULLNo

    Only for matched records i can see the project number, But i also need to see Project Number for NO case also. How can i acheive this?

    Thanks