I'm having trouble getting the last record of every id
in a SQL Server table.
select c.Serial,v.Descricao,v.Placa,v.Cor,v.AnoFabricacao,v.Chassi
c.DataHora,c.Endereco from [CheckPoint] c inner join Equipamento e on e.Serial= c.Serial
inner join Veiculo v on v.Codigo=e.CodigoVeiculo
where v.Codigo in(44,45)
group by v.codigo,c.Serial,v.Descricao,v.Placa,v.Cor,v.AnoFabricacao,v.Chassi
,c.DataHora,c.Endereco
order by
c.DataHora desc
This query is returning the following data in that order, I would like you to show me the most current record of each code.