Alaska Software Inc. - Select LAST record with SQL.
Username: Password:
AuthorTopic: Select LAST record with SQL.
César Calvo Select LAST record with SQL.
on Sat, 25 May 2024 21:41:50 +0200
Please, this works fine for Microsoft Access:

SELECT Last(DIA) AS ÚltimoDeDIA, DIMARCAS.IDE, DIMARCAS.PAG, 
DIMARCAS.MAR, DIMARCAS.DCO FROM DIMARCAS GROUP BY DIMARCAS.IDE, 
DIMARCAS.PAG, DIMARCAS.MAR, DIMARCAS.DCO ORDER BY DIMARCAS.IDE;

But Las(DIA) only works with access.

¿How would be for other database like Advantage Database Server)

I am thinking about MAX but no got it.
Regards.
César.
Andreas Gehrs-Pahl
Re: Select LAST record with SQL.
on Mon, 27 May 2024 18:03:18 -0400
César,

>SELECT Last(DIA) AS ÚltimoDeDIA, DIMARCAS.IDE, DIMARCAS.PAG, 
>DIMARCAS.MAR, DIMARCAS.DCO FROM DIMARCAS GROUP BY DIMARCAS.IDE, 
>DIMARCAS.PAG, DIMARCAS.MAR, DIMARCAS.DCO ORDER BY DIMARCAS.IDE;

How about:

SELECT DIA AS ... ORDER BY DIMARCAS.IDE DESC LIMIT 1;

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC