Welcome Guest, Not a member yet? Register   Sign In
Get last two records from table using active records
#1

[eluser]ibnclaudius[/eluser]
How can I get the last two records from a table?

For example I have this:

id | update
1 | a
2 | b
3| c
4 | d
5 | e

I want to return it like this:

4 | d
5 | e

with order_by(id, 'DESC'), it returns:

5 | e
4 | d

How can I do this with active records?


Messages In This Thread
Get last two records from table using active records - by El Forum - 02-24-2012, 03:11 PM
Get last two records from table using active records - by El Forum - 02-24-2012, 03:23 PM
Get last two records from table using active records - by El Forum - 02-24-2012, 03:26 PM
Get last two records from table using active records - by El Forum - 02-24-2012, 03:44 PM
Get last two records from table using active records - by El Forum - 02-24-2012, 03:51 PM
Get last two records from table using active records - by El Forum - 02-25-2012, 04:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB