Hey,
I have column in a table which contains numbers. How can I retrieve the max value from that column? Do I have to use rawsql-query or is it possible to do with Dataobject::get?
Thanks in advance!
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hey,
I have column in a table which contains numbers. How can I retrieve the max value from that column? Do I have to use rawsql-query or is it possible to do with Dataobject::get?
Thanks in advance!
$iMax = DB::query("SELECT MAX(\"Field\") FROM \"DataObjectClassName\"")->value();
Is the ID somewhere stored in the database?
yes the it's called "ID" in the database, it is also viewable by inspecting links in the CMS
I meant the maximum ID, where is that stored in the database?
Or is it stored somewhere else?
Sorry for not being precise enough...