 <p>I assume that <code>a.ids</code> is some kind of id list, so you could use the <a href="http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_find-in-set" rel="nofollow"><code>find_in_set()</code></a> function:</p> <pre><code>select * from table1 a join table2 b on find_in_set(b.id, a.ids) &gt; 0 </code></pre>