sqlnavicat

How to find matching values in two different tables SQL


I am trying to write a statement to find matching values from two different tables and set table 1 suppression to 1 if person_id from table 2 matches person_id from table 1 in SQL.

Table 1 = id_num, person_id, phone_number, supression

table 2 = person_id, uid

So if person_id from table 2 matches person_id from table 1 it should set each record to 1 in suppression column in table 1.


Solution

  • Thank you for the first suggestion. I ended up going with the below

    update in_12768_load1_all set "suppression" = '1' from (select * from "sup1027") as a where a."person_id" = in_12768_load1_all."person_id";

    I thought I explained my question pretty well. No clue why someone would down arrow this.