title: How do I avoid redundant data fields in the result set when using JOINs?
body: <p>Following join is supposed to retrieve user info along with their messages for users with a certain status:</p>
  
  <pre><code>SELECT * FROM user, message WHERE message.user_id=user.id AND user.status=1
  </code></pre>
  
  <p>The problem is that all rows about a certain user in the result set contain redundant columns that repeat the same data about that user (those fields retrieved from user table), only fields from the message table contain non-redundant information. Something like this:</p>
  
  <pre><code>user.id  username email            message.id  subject
  1        jane     jane@gmail.com   120         Notification 
  1        jane     jane@gmail.com   122         Re:Hello 
  1        jane     jane@gmail.com   125         Quotation
  2        john     john@yahoo.com   127         Hi jane
  2        john     john@yahoo.com   128         Fix thiss 
  2        john     john@yahoo.com   129         Ok
  3        jim      jim@msn.com      140         Re:Re:Quotation
  </code></pre>
  
  <p>As you can see many data are redundant and we do not want to first find the users and then go about their messages in loop like structures or something like that. Loops that cause micro-queries should be avoided at all costs. </p>
  
  <p>I am not concerned about the output of my program, that is well handled in the UI. I <em>think</em> perhaps the network traffic produced by returning the result of this query could be substantially reduced if somehow I can manage to eliminate the repetition of user data in all rows pertaining to that user.</p>