title: How to properly use inner join in SQL when I have to join a table twice?
body: <p>Note: The actual schema isn't male/female, but some other criteria. I'm just using male/female for this example to make it easier to understand.</p>
  
  <p>I have a table "users", which contains a column user_name and user_gender. The gender can be "M" or "F".</p>
  
  <p>The problem is that I have another table, "messages", that has a column for "sender" and "receiver". These columns contains user_name in each row.</p>
  
  <p>How can I use INNER JOIN so that I can get messages where only males send to females? </p>
  
  <p>I know easily how to specify it once, binding users.user_name to "sender" or "receiver" but not both.</p>
  
  <p>To expand on my question, how do see which top 10 pairs where a male sent the most messages to a female? Note, this means unique A/B pairs, so I want to return cases where a guy sends a single female a ton of messages, not when a guy spams a lot of messages to different females. </p>