title: How do I use join clause to only check whether row exists?
body: <p>I have two tables like this:</p>
  
  <pre><code>// Posts
  +----+---------+-----------------+----------+
  | id |  title  |    content      |  amount  |
  +----+---------+-----------------+----------+
  | 1  | title1  | content1        | NULL     |
  | 2  | title2  | content2        | 1000     |
  | 3  | title3  | content3        | 5000     |
  | 4  | title4  | content4        | NULL     |
  | 5  | title5  | content5        | 2000     |
  +----+---------+-----------------+----------+
  //                                 ^ NULL means that question is free
  
  
  // Money_Paid
  +----+---------+---------+
  | id | user_id | post_id |
  +----+---------+---------+
  | 1  | 123     | 2       |
  | 2  | 345     | 5       |
  | 3  | 123     | 5       |
  +----+---------+---------+
  </code></pre>
  
  <p><strong>All I'm trying to do:</strong> Some of my posts aren't free and anybody wants to see them should pay their cost. Now I need a query to check current user paid the cost of that post or not? <em>(just for non-free post)</em></p>
  
  <pre><code>SELECT * FROM Posts p WHERE id = :post_id
  LEFT JOIN Money_Paid mp ON p.amount IS NOT NULL AND ...
  </code></pre>
  
  <hr>
  
  <p>Here is a few <strong>examples</strong>: <em>(based on current tables)</em></p>
  
  <pre><code>$stm-&gt;bindValue(":post_id", 2, PDO::PARAM_INT);
  $stm-&gt;bindValue(":user_id", 123, PDO::PARAM_INT);
  //=&gt; TRUE (the user of '123' can see this post because he paid post's cost)
  
  $stm-&gt;bindValue(":post_id", 2, PDO::PARAM_INT);
  $stm-&gt;bindValue(":user_id", 345, PDO::PARAM_INT);
  //=&gt; FALSE (the user of '345' cannot see this post because he didn't pay post's cost)
  
  $stm-&gt;bindValue(":post_id", 5, PDO::PARAM_INT);
  $stm-&gt;bindValue(":user_id", 345, PDO::PARAM_INT);
  //=&gt; TRUE
  </code></pre>
  
  <hr>
  
  <p><strong>All I want of the query:</strong> I want a column contains  <code>true</code> or <code>false</code> <em>(just for non-free posts)</em> to tells me current user paid the cost of current post or not. In other word:</p>
  
  <p>There is a row in <code>Money_paid</code> table which <code>user_id = :user_id</code> => <code>true</code></p>
  
  <p>There isn't any row -> <code>false</code></p>