Get only latest 5 records

Hi,
I have Dreamfactory installed on a VM and connected to a MySQL db. All works fine. The database table I am interesting in have a ID column and a timestamp column, and some other columns too.

I would like to get the latest five records returned by a query. It can either be the five-latest based on timestamp or 5 highest ID numbers.

Any ideas if this is possible with filters? Or if I can execute a mySQL query direct, that would be perfect too.

Thanks!

Hi,
You have to use “get /mysqldb/_table/{table_name}” from the API Docs. This API provides a filter, limit, order options etc. Use them. Such as: for table name, write your table name, for limit enter 5, for order enter ID DESC. This will reverse order your results and limit your query to 5.

1 Like