Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +---------+---------+----------+
- | TABELA2 | TABELA1 | |
- +---------+---------+----------+
- | cod1 | cod1 | |
- +---------+---------+----------+
- | | cod2 | EXCLUIDO |
- +---------+---------+----------+
- | cod3 | cod3 | |
- +---------+---------+----------+
- | | cod4 | EXCLUIDO |
- +---------+---------+----------+
- $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);
- }
- select * from tabela1 t1 where not exists(select * from tabela2 t2 where t2.id = t1.id )
- update tabela1 t1 set t1.status = "EXCLUIDO" where not exists(select * from tabela2 t2 where t2.id = t1.id )
Add Comment
Please, Sign In to add comment