0
Hello, I’m comparing two tables that have the same data, tabela1
and tabela2
, to tabela2
will have data deleted over time, and so need to identify the field that was deleted and insert an "delete status" in a column of the tabela1
.
I’ll try to explain it this way:
+---------+---------+----------+
| TABELA2 | TABELA1 | |
+---------+---------+----------+
| cod1 | cod1 | |
+---------+---------+----------+
| | cod2 | EXCLUIDO |
+---------+---------+----------+
| cod3 | cod3 | |
+---------+---------+----------+
| | cod4 | EXCLUIDO |
+---------+---------+----------+
Code I already have, it already performs the comparison but does not include the status of "deleted":
$teste1 = "SELECT * FROM tabela2 as a INNER JOIN tabela1 as c ON (a.cod2=c.cod1)";
$teste2 = mysqli_query ($db,$teste1);
while($teste3 = mysqli_fetch_array($teste2)){
$teste = $teste3["0"];
$insert = "UPDATE tabela1 SET campo = 'Entregue' WHERE cod1 NOT IN ($teste)";
mysqli_query ($db,$insert);
}
Thank you very much!! It worked perfectly, thank you very much!
– user65739