title: MYSQL query check if user like
body: <p>I'm asking for query statement I have two tables 
  first table 'posts' :</p>
  
  <pre><code>post_id     title    Userid
  1           test     1
  </code></pre>
  
  <p>The other table is 'likes'</p>
  
  <pre><code>userid  post_id
  1       1
  </code></pre>
  
  <p>I need single query to check if user like this photo or not in bulk select my solution is very poor :</p>
  
  <pre><code>SELECT * FROM `table` WHERE x = x LIMIT 100;
  </code></pre>
  
  <p>and give it foreach and make query for every row :</p>
  
  <pre><code>foreach($results as $v)
  {
     $data[1] = $v;
     $data[1]['is_like'] = SELECT COUNT(*) FROM likes WHERE userid = 1;
  }
  </code></pre>
  
  <p>1 is the already login user id</p>
  
  <p>I need to single query to return post_id,.. etc and filed like is_like </p>