I have this query
SELECT Reg.id_Movimiento, Tip.NombreTipoMov FROM ut_sgt_Movimientos_t Reg INNER JOIN ut_sgt_TiposMovimientos_m Tip ON Reg.id_TipoMov = Tip.id_TipoMov WHERE Reg.id_Registro = 367
With this output:
8 Retiro
6 Marcaje
7 Porteador
5 Descarga
1 Almacenaje
How can i select the record with the highest id value?
I can not use subquery, set rowcount or top 1, only agregate functions, having or group by
I have tried:
SELECT Reg.id_Movimiento, Tip.NombreTipoMov FROM ut_sgt_Movimientos_t Reg INNER JOIN ut_sgt_TiposMovimientos_m Tip ON Reg.id_TipoMov = Tip.id_TipoMov WHERE Reg.id_Registro = 367 HAVING Reg.id_Movimiento = MAX(Reg.id_Movimiento)
But the output is
8 Retiro
8 Marcaje
8 Porteador
8 Descarga
8 Almacenaje
Well, since you specify what you cannot use, I'll assume everything else is fair game.