0
Hello! this doubt arose in mysql query;
because the status is coming different from the table?
follow my consultation:
SELECT DISTINCT max(idEmbreagem) as idEmbreagem, b.prefixo as idVeiculo, max(datamontagem) as datamontagem, max(kmmontagem) as kmmontagem, max(horimetromontagem) as horimetromontagem, max(c.km) as kmatual, max(c.horimetro) as horimetroatual, a.`status`, max(tipoembreagem) as tipoembreagem, (max(c.km) - max(a.kmmontagem)) as kmrodados FROM embreagem a
JOIN veiculos b on (a.idVeiculo=b.idVeiculo)
JOIN hodometro c on (a.idVeiculo=c.idVeiculo)
GROUP BY a.idVeiculo order by idVeiculo ASC
What a load of
MAX()
?– Marcelo Shiniti Uchimura
latest data from each vehicle
– Diogo Carvalho