How to get second last record in AX 2009

hi all,

How to get second last record using select statement in ax 2009?

Thanks in advance.

Regards,

Amol.

You can’t do it directly, nevertheless you can order records from latest, limit the number to 10 (firstOnly10), iterate through the records and take the second one only.

Hi Sir,

Thanks for your reply. I am sorting record descending by recid and want to chose second one, how it is possible.

Regards,

Amol

Which part of my answer you don’t understand?

Hi

U will have to use a double select statement

Common Tablebuffer,Tablebuffer1;

select firstonly * from Tablebuffer order by recid desc;

select firstonly * from Tablebuffer1 order by recid desc

where Tablebuffer1.recid != Tablebuffer .recid;