title: Creating multivalue search, struggling with SQL
body: <p>Based on user input, which could be a single or multiple values, and using the following table</p>
  
  <pre><code>+------+--------+
  | seed |  item  |
  +------+--------+
  |    1 | apple  |
  |    1 | grapes |
  |    2 | apple  |
  |    3 | grapes |
  |    3 | banana |
  +------+--------+
  </code></pre>
  
  <p>I want to return</p>
  
  <ul>
  <li>1 when the user entered (apple, grape),</li>
  <li>[1, 2] for (apple), and</li>
  <li>nothing for (apple, banana).</li>
  </ul>
  
  <p>My current PHP code</p>
  
  <pre><code>$keyword = Input::get('keyword');
          $searchTerms = explode(",", $keyword);
          $query = DB::table('items');
          foreach($searchTerms as $term)
          {   
              $query-&gt;where('item', 'LIKE', '%'.$term.'%');
          }
          $results  = $query-&gt;distinct()-&gt;get(array('seed'));
  </code></pre>
  
  <p>works for single values. Iterating in the loop, I'm just appending more search terms to the current $query. At the end, I need to find the intersection of all the queries. This is currently my main concern.</p>