Identify if a record exists on a table

  • I have two tables (PmtTrn & AdjTrn). Both of these table a column called Itrn. Basically, if the same records on AdjTran table exist as in PmtTrn table, I want it to be flagged as "Yes" on PmtTrn table.

    How can I acheive this? Am I table to use Case Expression? If so, any hints or suggestions would be helpful.

  • Please provide the DDL and some sample data with the expected results. This will help people to reply faster.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Hi

    As u said, the column name "itrn" is same in both the tables. Please let us know the column name to be updated to "YES" on the existence of the same record on both these tables.

    Regards

    Priya

    Regards
    Priya

  • you can update the column to 'YES' using the from clause and inner join. some thing like

    update PmtTrn

    set PmtTrn.column_yes = 'YES'

    From PmtTrn

    Inner Join AdjTrn

    on AdjTrn.itrn = PmtTrn.itrn

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply