• SQLTestUser (6/17/2013)


    yes that is pretty easy to select them and check what value is there its just the update i am struggling with. here is the select

    select P.Id, P.Desc as PD,

    Tf.Description as TF ,

    PC.PID as PCI,

    PM.OP as Op

    from P left join TF ON

    P.ID = TF.ID

    left join PC on

    Pc.ID = P.ID

    left Join PCM on

    PCM.ID = P.ID

    OK so we are part way there. You have me at an extreme disadvantage here. Your original tables were all A,B,C etc now they are all different completely cryptic names (I hope those are not the real names of your tables).

    What I don't understand is the business logic. This query returns 5 columns. I think you are wanting to see if some are NULL or that sort of thing? I also don't know the relationship from any of these tables to your audit table. To get your values I think you either want to use coalesce or a case expression. The business rules will help determine what would work best.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/