We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7575
    • 85 Posts
    hi
    I understand how I can get objects with xpdo
    but now I want to get somthing like the following:

    select max(id) form mytable where year=2000 and category_id=5

    I have a mytable object but I can't seem to get this query going

    I just need the max(id) nothing else... [ed. note: opengeek last edited this post 14 years, 3 months ago.]
      www.tornooi.net online database for (sport) events in dutch.
      To be redesigned, rewritten to modx with multiple languages...
      ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
      • 22303 MODX Staff
      • 10,725 Posts
      $query = $xpdo->newQuery('MyTable', array('year' => 2000, 'category_id' => 5));
      $query->select('MAX(id)');
      $maxId = $xpdo->getValue($query->prepare());
        • 7575
        • 85 Posts
        tnx for the quick tip,
        but I can't get it to work.
        what should I try next?
          www.tornooi.net online database for (sport) events in dutch.
          To be redesigned, rewritten to modx with multiple languages...
          ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.