0
I have two tables to pedido_tb and the pedido_grade, what I want to do is compare, the values of the column "request" of the requested table and column "n_pedido" of pedido_grade, basically, would like to get the values you have in pedido_tb and do not have in pedido_grade.
I tried the following code:
$sql = "SELECT pedido FROM pedido_tb WHERE pedido NOT IN (SELECT n_pedido FROM pedido_grade)";
$disp_sql = $mysqli->query($sql);
$num = $disp_sql->num_rows;
echo "</br>número de linhas ".$num."</br>";
Does anyone have any idea why nothing returns?
The query is apparently correct. I answered your question using LEFT JOIN, if it doesn’t work check if your php errors are not disabled, there may be some connection error or pointing to a wrong base. has n possibilities.
– arllondias