I was able to find the rows I need to update with the following code. The old_ pris is to be updated with the new_pris .
I am always one step back when it comes to update and insert operations.
As far as I know I can do a inset into and select statement as I have below for a insertion, but for update!!. Just looking if there is something I should consider looking into.
SELECT o.no as old_no
,o.name as old_name
,n.kid as new_kid
,o.aPris as old_pris
,n.pro_pris as new_pris
,n.id as new_id
FROM [db1].[dbv].[tb1] n
left join db1.dbv.tb2 o
on n.barcode =o.code
where
o.code =n.barcode
and o.no !=''
and n.barcode !=''
and o.code!=''
the select terms are mixed to let you know the contents of tables I am dealing with. I just need to update the old_pris by new_pris but the join and the where conditions remain same.
You can
UPDATEwithJOINlike so: