title: How to Select an Item with Multiple Hashtags
body: <p>I have 3 tables in my database.</p>
  
  <p>Table <code>tags</code> consists of: <code>tag_id</code>, <code>tag_name</code></p>
  
  <p>Table <code>person</code> consists of: <code>person_id</code>, <code>person_name</code>, etc</p>
  
  <p>Table <code>maintag</code> consists of: <code>main_tag_id</code>, <code>tag_id</code>, <code>person_id</code></p>
  
  <p>For example, there is someone named Benny that has tags <code>new york</code>, <code>fat</code> and <code>smart</code>. Every time I search like this:</p>
  
  <pre><code>SELECT p.person_name, p.gpa, p.phone_number FROM person p
  LEFT JOIN maintag mg ON mg.person_id = p.person_id
  LEFT JOIN tags t ON t.tag_id = mg.tag_id
  WHERE t.tag_name LIKE '%fat%' AND t.tag_name LIKE '%smart%'
  </code></pre>
  
  <p>It will return 0. What should my query look like when I want to select an item with multiple tags?</p>
  
  <p>I've read <a href="https://stackoverflow.com/questions/31460215/mysql-select-all-items-with-multiple-hashtags">MySQL - select all items with multiple hashtags</a> and that doesn't answer my question.</p>