In this SELECT JOIN
, all tables have columns with the same name.
With this, it gives a conflict at the time of listing.
Example: column Id_saida
it is in all tables. How to list each one?
$cmd = "SELECT f.*,a.*,e.*,p.*,m.*,v.* FROM a_finan AS f
INNER JOIN agenda_saidas AS a
ON a.id_saida = f.id_saida
LEFT JOIN empresas AS e
ON e.id_empresa = f.id_empresa
LEFT JOIN passageiros AS p
ON p.id_saida = f.id_saida
LEFT JOIN motoristas AS m
ON m.id = a.id_motorista
LEFT JOIN veiculos AS v
ON v.id_veiculo = a.id_veiculo
where a.id_transfer1 = '$id_transfer' AND f.id_transfer =
'$id_transfer'
AND e.id_transfer = '$id_transfer'
AND a.start BETWEEN '$de' AND '$ate'
";
$produtos = mysql_query($cmd);
$total = mysql_num_rows($produtos);
while ($linha = mysql_fetch_array($produtos)) {
$id_saida = $linha['id_saida']; // Coluna id_saida em todas as tabelas
$id_saida = $linha['id_saida']; // tabela 2
$id_saida = $linha['id_saida']; // tabela 3
}