db_select with groupBy(CAST(column as DATE)) I am looking to achieve GROUP BY CAST(date_time AS DATE) in a db_select function in Drupal 7 but with no idea how.

The function up until now is:

 foreach ($distinct_users as $user){
    $day_record = db_select('mytable', 'p')
      -&gt;condition('p.processed', 0, '=')
      -&gt;condition('p.first_name', $user['first_name'], '=')
      -&gt;condition('p.last_name', $user['last_name'], '=')


and I need to group the results by day which is in Y-m-d H:i:s in my table column.

Please advise.
The solution that worked for me was to group results via php.