mnesia - return the two last record in erlang -


i have record :

-record(person, {id, firstname, lastname}). 

and table contains kind of values :

1  anis    hila 2  samir   alagi 3  marwen  fares 4  sana    gabsi 5  safa    sassi 

i want develop function return last 2 record of table person

meaning return :

4  sana    gabsi 5  safa    sassi 

i have code return last id

key=mnesia:last(person). 

can me resolve problem

how this:

lastkey = mnesia:last(person) secondlastkey = mnesia:prev(person, lastkey) 

Comments