So I have a STG table and in that I have a flag field which needs to be updated to 1 just for few employees who are in the particular job post and the other employees values should be unchanged.
I have given a sample data the actual consists of 100+ columns so included which are common
STG Table
Post Table
So to identify the employees who are in that post I have to fetch the value from a different table which has the identification logic has job_post like '%Specialist%' and the setid ='C65' from the post_tbl so the values can't be mapped between these two tables because they don't have any same values or primary key. So can you please help me write a update query with if above condition is true then update the flag value to 1.
I tried:
update STG_Table
set Flag = 1
form STG_Table STG inner join Post_Table P
on STG.job_post = P.job_post
where upper(P.descr) like '%Specialist%'
and P.setid = 'C65';
Expected O/P:
So, can someone please guide me on the following.



If possible you should fix your table design.
Some suggestions
stg_table_idon thePost_Tabletable.Please for further questions use text only (as I have posted below) not images.
Regarding your question an options is to use like on the join condition.
Consider your data example
If we use
Result
Now, lets transform it in an update clause
Result
Note
An index on
setidmight speed things up, but in larger data you might face some performance issues because of like '%%' usage.