• bawinkley (8/6/2013)


    I am having trouble working out exactly what you are asking but see below it may help you?

    UPDATE

    --table to update

    Values1

    SET

    --column you want the value inserted into and from

    Values1._Value = Values2._Value

    -- normal join

    FROM

    Values1

    INNER JOIN

    Values2

    ON

    Values1._ID = Values2._ID

    -- use where as your if statement

    where Values1._Value = Values2._Value_2

    What I am asking for is ddl and sample data. That means create table statements and insert statements. I can't possibly know if any code I might toss together will work when I have nothing to work with. Please take a few minutes and read the article in my signature about best practices when posting questions.

    _______________________________________________________________

    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/