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

sander_cassiers’s picture

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.