1
I’m having trouble getting the last record of each id
in an 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 this returning me the following data in that order, I would like you to show me the most current record of each code.
You can set an example, or indicate which output you want to get?
– bruno
I need to Get the most current record of each ID ! that is, the query has to return 2 lines!
– Hans Miller
You can check below, my reply, to see if it returns the expected result?
– bruno