This works:
public static function getLastFoo() {
return fRecordSet::build('Foo')->sort('getId', 'desc')->getRecord(0);
}
Question
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);
}
OTHER TIPS
There is not better way with ORDER BY and LIMIT?
SELECT * FROM Foo ORDER BY id DESC LIMIT 1
Use DESC for highest value.
Try:
select max(id),foo.* from foo order by id desc limit 1