Search code examples
phpmysqlflourishlib

How to get the record with maximum id?


I am using MySQL with Flourish. Let's suppose I have a table called Foo and it has a column called id. My question is:

What is the flourish equivalent for the following query:

select * from Foo where id = (select max(id) from Foo);

Thanks


Solution

  • This works:

    public static function getLastFoo() {
        return fRecordSet::build('Foo')->sort('getId', 'desc')->getRecord(0);
    }