title: GROUP BY clause or be used in an aggregate function
body: <p>I want to group by <code>sender_id</code>, but I get the following error:</p>
  
  <blockquote>
    <p>column "users.first_name" must appear in the GROUP BY clause or be used in an aggregate function</p>
  </blockquote>
  
  <pre><code>SELECT users.first_name, users.last_name, users.avatar_url, users.age, chatting.content, chatting.sender_id, chatting.received_id, chatting.created_at as created_at_chatting
  FROM users, chatting 
  WHERE chatting.received_id = users.id 
    AND received_id='4' 
  GROUP BY chatting.sender_id
  </code></pre>
  
  <p>tb_chatting</p>
  
  <pre><code>chatting_id | content | received_id | sender_id 
  1           | hallo   | 4           | 5
  2           | whoaa   | 4           | 6
  3           | wow     | 4           | 5
  </code></pre>
  
  <p>tb_users</p>
  
  <pre><code>user_id | first_name  | last_name | age | avatar_url 
  5       | dicky       | perdian   | 12  | httpxxxxxxx
  6       | ferda       | est       | 13  | httpsxxxxxx
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>avatar_url | first_name | last_name | content 
  httpxxxxxxx| dicky      | perdian   | hallo 
  httpsxxxxxx| ferda      | est       | whoaa
  </code></pre>