 <p>According to your description in comments, try this:</p> <pre><code>select key,keyword from table1 where key='a=1' union all select product_id,store_id from table2 where product_id='1' and store_id='7' </code></pre>