function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tocktock 

What's the best way to get the last record in a table

Hello,
  I'm trying to find a query that will return the last ID created in the accounts table, can anyone tell me the PHP for this please?
 
Cheers.
SuperfellSuperfell
this is the SOQL you need to run, not sure how you do it from PHP

select id from account order by createdDate desc limit 1
tocktock
That's great, cheers Simon.