How do I make this query:
I have 3 tables A
B
and C
Table A
is related to ID's of Table B
.
I need to get the ids of B
whose xcampo
equals xcampo
of C
.
now you must update xcampo
of A
that contains the IDs that I just got from table B
.
I already do it in the following way, I do a INNER JOIN
of B
and C
, I export those ID'S and then I update the table A
with a csv
of those ID's but I would like to know if someone could have a more compact and faster formula.
I applied the chosen solution as the correct one (and it worked perfectly) my personal code stayed like this:
UPDATE pai_titulo AS a,
(
SELECT
pai.id ,update2.decreto
FROM
pai
INNER JOIN
update2
On update2.cedula = pai.numero_documento
) AS b
set a.requerido_decreto_pep = b.decreto
WHERE a.id_pai = b.id