0
I need to do a list with sub select, and even managed to do it using a condition, however, I need it to occur 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 case I have two tables, one named "ordem_servico" and the other "vehicle".
and in my application I need to list some data of the order of service, are they, ID_OS, STATUS, PROBLEM and the vehicle PLATE related to ID_CARRO
PHP listing looks something like this
function listar( $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??
Putz, I didn’t even remember the kkk joins thank you very much
– Igor
We are there for that ;P, if you decided not to forget mark an answer as accepted.
– Barbetta