Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By sander_cassiers on
How can i show the max values from a dynamic query?
$query = db_select('data', 'n')
->fields('n', array('field1, max(field2)))
->groupBy('field1')
->execute();
this doens't work
Comments
This two posts may help you
This two posts may help you :
http://drupal.stackexchange.com/questions/9540/add-a-max-aggregation-fun...
http://drupal.org/node/1113158
stupid me
Hey, it is fixed.. the type from the database was set on 'VARCHAR'.
so there could not be a max value for it..
I changed it to integer, and it works just fine.