title: How to fix query group with only_full_group_by
body: <p>I have a basic key-value table, that has some data in it for each user. With the updated mysql it has the <code>sql_mode</code> set to <code>only_full_group_by</code> (new default) when you do a group by. When I try to run this simple query:</p>
  
  <pre><code>select * from user_features
  where user_id = 1
  group by feature_key
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>SQL Error (1055): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'date.user_features.user_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by</p>
  </blockquote>
  
  <p>With this example data, I want to group based on the <code>feature_key</code> (I will add a <code>group_concat</code> once the group error is fixed).</p>
  
  <pre><code>| user_id | feature_key | feature_value |
  +---------+-------------+---------------+
  | 1       | color       | red           |
  +---------+-------------+---------------+
  | 1       | age         | 15            |
  +---------+-------------+---------------+
  | 1       | color       | blue          |
  +---------+-------------+---------------+
  </code></pre>
  
  <p>The table looks like this:</p>
  
  <pre><code>CREATE TABLE `user_features` (
    `user_id` int(10) unsigned NOT NULL,
    `feature_key` varchar(50) NOT NULL,
    `feature_value` varchar(50) NOT NULL,
    UNIQUE KEY `user_id_feature_key_feature_value` (`user_id`,`feature_key`,`feature_value`)
  )
  </code></pre>
  
  <p>What query can I run to fix this or what index(es) do I need to add?</p>