title: Transfer data from one table to another with both table having same id, in Postgres
body: <p>I have 2 tables. TBL_A and TBL_B. I want to update <code>TBL_A</code> so that <code>A_NAME = B_NAME, where A_LA = B_LA</code>. How do I do this? <br>This is just s sample data. In the real table, I have thousands of records on each table.
  <br>
  I tried connecting both tables using View, but it seems that the view can't be updated.</p>
  <p>TBL_A:<br>
  <a href="https://i.stack.imgur.com/hmaRV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hmaRV.jpg" alt="enter image description here" /></a></p>
  <pre><code>CREATE TABLE public.&quot;TBL_A&quot;
  (
  &quot;A_LA&quot; character varying,
  &quot;A_NAME&quot; character varying,
  &quot;A_ID&quot; bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 1000 CACHE 1 ),
  CONSTRAINT &quot;TBL_A_pkey&quot; PRIMARY KEY (&quot;A_ID&quot;)
  );
  
  INSERT INTO public.&quot;TBL_A&quot;(&quot;A_LA&quot;, &quot;A_NAME&quot;) VALUES ('8904001', '');
  INSERT INTO public.&quot;TBL_A&quot;(&quot;A_LA&quot;, &quot;A_NAME&quot;) VALUES ('8904003', '');
  INSERT INTO public.&quot;TBL_A&quot;(&quot;A_LA&quot;, &quot;A_NAME&quot;) VALUES ('8904005', '');
  </code></pre>
  <p>TBL_B:<br>
  <a href="https://i.stack.imgur.com/wGKEA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wGKEA.jpg" alt="enter image description here" /></a></p>
  <pre><code>CREATE TABLE public.&quot;TBL_B&quot;
  (
  &quot;B_LA&quot; character varying,
  &quot;B_NAME&quot; character varying,
  &quot;B_ID&quot; bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 1000 CACHE 1 ),
  CONSTRAINT &quot;TBL_B_pkey&quot; PRIMARY KEY (&quot;B_ID&quot;)
  );
  
  INSERT INTO public.&quot;TBL_B&quot;(&quot;B_LA&quot;, &quot;B_NAME&quot;) VALUES ('8904001', 'John');
  INSERT INTO public.&quot;TBL_B&quot;(&quot;B_LA&quot;, &quot;B_NAME&quot;) VALUES ('8904002', 'James');
  INSERT INTO public.&quot;TBL_B&quot;(&quot;B_LA&quot;, &quot;B_NAME&quot;) VALUES ('8904003', 'Jacob')
  INSERT INTO public.&quot;TBL_B&quot;(&quot;B_LA&quot;, &quot;B_NAME&quot;) VALUES ('8904004', 'Jared')
  INSERT INTO public.&quot;TBL_B&quot;(&quot;B_LA&quot;, &quot;B_NAME&quot;) VALUES ('8904005', 'Josh');
  </code></pre>
  <p>View:<br>
  <a href="https://i.stack.imgur.com/neXGB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/neXGB.jpg" alt="enter image description here" /></a></p>
  <pre><code>CREATE VIEW public.&quot;A_B_CONNECT_VIEW&quot; AS
  SELECT &quot;TBL_A&quot;.&quot;A_LA&quot;,&quot;TBL_A&quot;.&quot;A_NAME&quot;,&quot;TBL_B&quot;.&quot;B_LA&quot;,&quot;TBL_B&quot;.&quot;B_NAME&quot;
  FROM &quot;TBL_A&quot; JOIN &quot;TBL_B&quot; ON &quot;TBL_A&quot;.&quot;A_LA&quot;::text = &quot;TBL_B&quot;.&quot;B_LA&quot;::text;
  </code></pre>