title: Can I use INNER JOIN on two columns of a table, refering to same Primary key of another table?
body: <p>So I have a simple DB_Schema, <strong>USER_INFO Table</strong> with columns <strong>Username and Full Name</strong>, <em><strong>username being the primary key of this table</strong></em>.
  I am building a simple Chat Website. I also have a <strong>MESSAGES Table</strong> which has 4 columns,</p>
  <ul>
  <li>AUTOGENERATED MESSAGE ID - PRIMARY KEY</li>
  <li>SENDER - REFERENCES USER_INFO Table's Username</li>
  <li>RECEIVER - REFERENCES USER_INFO Table's Username</li>
  <li>MESSAGE - String of Message sent</li>
  </ul>
  <p>I was trying to get details of Message, Sender(Full Name) and Receiver(Full Name) using <strong>INNER JOIN</strong>, MY SQL QUERY WAS :</p>
  <blockquote>
  <p>SELECT message, sender, user_info.name as sender, receiver, user_info.name as  receiver <br> FROM lets_chat.privatechat <br> INNER JOIN user_info ON privatechat.sender = user_info.username <br> INNER JOIN user_info ON privatechat.receiver = user_info.username;</p>
  </blockquote>
  <p>This resulted in an error : <strong>ERROR CODE 1066: Not Unique Table/alias: 'user_info'</strong>.<br> Could someone help me correcting my error or getting me the correct SQL Statement to do this? I use <strong>MYSQL DB</strong>.</p>
  <p>I am good at SPRING-HIBERNATE and I am able to do it properly in that, just needed help with SQL. <strong>Thank You in advance</strong></p>
  <p><em><strong>UPDATE ANSWER</strong></em></p>
  <blockquote>
  <p>SELECT PVC.message, UI1.name as sender, UI2.name as receiver <br>
  FROM lets_chat.privatechat AS PVC <br>
  INNER JOIN user_info AS UI1 ON UI1.username = PVC.sender <br>
  INNER JOIN user_info AS UI2 ON UI2.username = PVC.receiver; <br></p>
  </blockquote>
  <p>This worked. Thank You @<a href="https://stackoverflow.com/users/3436271/plaiddk">plaidDK</a></p>