I need to do a list with sub select, and I even managed to do it using a condition, but I need to do it without condition with the condition would look something like this:
SELECT *,(SELECT PLACA from veiculo WHERE ID_CARRO = "1654641106") as placa from ordem_os
In the case I have two tables, one named "plant-order" and the other "vehicle."
InmyapplicationIneedtolistsomeoftheserviceorderdata,theyareIDOS,STATUS,PROBLEM,andthevehiclePLATEfortheID_CARRO
thePHPlistinglookssomethinglikethis
functionlistar($link){$select="SELECT * FROM ordem_os ";
$result = mysqli_query($link, $select);
$linha = mysqli_fetch_assoc($result);
if( !empty($linha) )
{
do
{
?>
<tr data-toggle="modal" data-target="#exampleModal">
<td><?php echo $linha['ID_OS'] ?></td>
<td><?php echo $linha['PLACA'] ?></td>
<td><?php echo substr($linha['PROBLEMA'], "0","40")."..." ?></td>
<td><?php echo $linha['STATUS'] ?></td>
</tr>
<?php
}while($linha = mysqli_fetch_assoc($result) );
}
else
{
?>
<tr>
<td colspan="4">
<div class="mensagem_nenhum_registro">
Ops!Nenhum registro encontrado
<br>
<img src="imagens/not_found_icon.png">
</div>
</td>
</tr>
<?php
}
}
? >
How should be my query to get the card referring to the "ID_CARRO" that is listed ??