How do I use "GROUP BY"?
Follow an example:

$result = db_query('SELECT tid, count(tid) AS count FROM {taxonomy_term_field_data} WHERE vid &lt;&gt; :vid GROUP BY tid', array(':vid' =&gt; 'tags'));


But, from docs...


  Deprecated
  
  as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get a
  database connection injected into your service from the container and
  call query() on it. For example, $injected_database->query($query,
  $args, $options);


More info in db_query.  

Edit 1:

Drupal set by default sql_mode with 'only_full_group_by', in your case when you use SELECT *, an database exception is throw, look in your log, you will see something like this:


  Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database.table.field' which is not functionally dependent on columns in GROUP BY clause.


So to correct this you must aggregate all fields in your SELECT list. If you only need e-mail list something like this can solve:

db_query('SELECT email FROM {contact} GROUP BY email');