title: MySQL IN() function not work
body: <p>I have a strange problem. IN() function on MySQL database stop to work.</p>
  
  <p>The structure of my table looks like this:</p>
  
  <pre><code>| id | name  | categories |
  ---------------------------
  | 1  | User1 | 1, 12, 55  |
  ---------------------------
  | 2  | User2 | 12, 55, 76 |
  ---------------------------
  | 3  | User3 | 1, 55, 76  |
  </code></pre>
  
  <p>To list the users by specific categories I do approximately like this:</p>
  
  <pre><code>SELECT * FROM `users` WHERE `categories` IN ('1','12','55')
  </code></pre>
  
  <p>or from only one category:</p>
  
  <pre><code>SELECT * FROM `users` WHERE `categories` IN ('76')
  </code></pre>
  
  <p>The problem is that if I ask only one parameter, I get no results. If ask more parameters, then listing only users by the first ID in the list and the other does not.</p>
  
  <p>Before I had no this kind of problem. I do not understand where I make mistakes. Thanks!</p>
  
  <h2><strong>EDIT:</strong></h2>
  
  <p>Thanks to @Andreas Hauser I finaly get right result.</p>
  
  <p>This is solution:</p>
  
  <pre><code>SELECT * FROM users WHERE FIND_IN_SET ('76',REPLACE(categories,' ',''));
  </code></pre>
  
  <p>This works exactly as it should. </p>
  
  <p>And other solutions are very smart and helpful, I will use them in the future especially solution from @Justinas and the proposal from @Bilal Rao for search in array of categories:</p>
  
  <pre><code>SELECT `u`.* FROM `user` `u` JOIN `category` `c` ON `c`.`user_id` = `u`.`id` WHERE `c`.`id` IN ('1', '5', '58');
  </code></pre>
  
  <p>Thank you guys for your help!</p>