Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Retrieving max value from Dataobject

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 435 Views
  • ville
    Avatar
    Community Member
    5 Posts

    Retrieving max value from Dataobject Link to this post

    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!

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Retrieving max value from Dataobject Link to this post

    $iMax = DB::query("SELECT MAX(\"Field\") FROM \"DataObjectClassName\"")->value();

    435 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.