title: Php mysql select where array in array
body: <pre><code>    id |   sales_id   
      ===+================
      1  |    1,2       
      2  |    1,2       
      3  |    3         
      4  |    1
  
  $id = array('1','2');
  
  $query-&gt;where($id.' IN (sales_id)'); 
  </code></pre>
  
  <p>I need return id : 1,2,4 </p>
  
  <p>From a column containing arrays</p>
  
  <p>Where array in array it's possible ?</p>
  
  <p>I solved it with a foreach , but I think there is a better solution</p>
  
  <pre><code>$sales = $this-&gt;getSales();
      foreach ($sales as $sale) {
  
          $db = JFactory::getDbo();
          $query = $db-&gt;getQuery(true);
          $query-&gt;select('*');
          $query-&gt;from('#__hair_service');
          $query-&gt;order('ordering ASC');
          if($id){
          $query-&gt;where('id = '.$id);    
          }
          $query-&gt;where('state = 1');
          $query-&gt;where($sale-&gt;id.' IN (sales_id)');
  
  
          $db-&gt;setQuery($query);
          $results[] = $db-&gt;loadObjectList();
       }
  
          $services = array();
          foreach($results as $result) {
          $services = array_merge($services, $result);
          }
  
      return $services;
  </code></pre>