title: mySQL Query w/ fulltext index search, return X number of results IF they have data in another table
body: <p>so, it's a hard to phrase question:</p>
  
  <p>I would like to be able to limit the amount of results returned while searching in a fulltext index. </p>
  
  <p>simply using <code>LIMIT 5</code> does not do what I need it to.</p>
  
  <p>I am searching with this query:</p>
  
  <pre><code>SELECT * FROM people 
  WHERE MATCH (name, email) AGAINST ('$val*' IN BOOLEAN MODE) 
  ORDER BY MATCH(name, email) AGAINST('$val*') 
  DESC
  </code></pre>
  
  <p>I need to add some sort of <code>IF</code> statement to this query to return proper rows.  Right now this returns the name and email of (let's say) 10 people. Only 6 of those people have "spots", meaning they've actually done something on the site.  The spots are counted in another table. If those people have done something (have 1+ spots) I'd like them to show in the result, whereas the people who have not done anything, I'd like to eliminate them from the search.</p>
  
  <p>So, in lamens terms (because I don't know how to technically do this) I need the search to say</p>
  
  <pre><code>SELECT * FROM people 
  WHERE MATCH (name, email) AGAINST ('$val*' IN BOOLEAN MODE) 
  ORDER BY MATCH(name, email) AGAINST('$val*') 
  ---as long as this person has at least 1 spot---
  DESC
  </code></pre>
  
  <p>The tables are set up like this:</p>
  
  <pre><code>people
  |id | name           | email               |
  |---|----------------|---------------------|
  |01 | John Smith     | jsmith@domain.com   |
  |02 | Johnny Johnson | Ejohnson@domain.com |
  |03 | Jon Aten       | name@domain.com     |
   ...
  
  
  spots
  |id | user_id | spot_number|
  |---|---------|------------|
  |01 |      01 |         01 |
  |02 |      01 |         03 |
  |03 |      01 |         06 |
  |04 |      01 |         12 |
  |05 |      01 |         04 |
  |06 |      03 |         02 |
  |07 |      03 |         15 |
  |08 |      03 |         31 |
  |09 |      01 |         12 |
  |10 |      01 |         10 |
  </code></pre>
  
  <p>As you can see, <code>Johnny</code> (user ID 2) does not have any spots in the spots table.  So I would like to be able to search for <code>jo</code> and only return user <code>1</code> and <code>3</code>.  Would this just create a slower query? should I limit the number of results afterwards? I will be searching through potentially millions of records eventually. I'm not sure where to go from here - any help is appreciated!</p>