Can I have a GROUP BY as an expression? Without an alias
This can be achieved like so:

$select = db_select('my_values', 'v')
  -&gt;condition('datetime', '2012-12-15 00:00:00', '&gt;')
  -&gt;condition('datetime', '2013-01-01 00:00:00', '&lt;')
  -&gt;orderBy('datetime', 'DESC');
$select-&gt;addExpression('FROM_UNIXTIME(ROUND(UNIX_TIMESTAMP(datetime)/60)*60)', 'datetime');
$select-&gt;addExpression('ROUND(MAX(value), 2)', 'value');

$groupBy = &amp;$select-&gt;getGroupBy();
$groupBy['gb'] = 'ROUND(UNIX_TIMESTAMP(datetime)/60)';

$result = $select-&gt;execute();


Which creates this query:

SELECT FROM_UNIXTIME(ROUND(UNIX_TIMESTAMP(datetime)/60)*60) AS datetime,
ROUND(MAX(value), 2) AS value 
FROM my_values v 
WHERE (datetime &gt; '2012-12-15 00:00:00') AND (datetime &lt; '2013-01-01 00:00:00') 
GROUP BY ROUND(UNIX_TIMESTAMP(datetime)/60) 
ORDER BY datetime DESC