title: How do I convert a list of arbitrary values into a subquery that can be used in a join
body: <p>I want to join a list of values with table rows in SQL.</p>
  
  <p>Shortly, I have a list of elements and I want to <code>join</code> this element with a given table. </p>
  
  <p>For example, my list is <code>(1,3,5,100,200,700)</code> and the <code>table</code> is:</p>
  
  <pre><code>id | val
   1 |  a
   2 |  b
   3 |  c
   4 |  d
  100|  e
  200|  f
  </code></pre>
  
  <p>I know how to do that with <code>in</code> clause:</p>
  
  <pre><code> SELECT * FROM table 
   WHERE id IN(list)
  </code></pre>
  
  <p>Unfortunately, in my situation (very-very long list) I cannot use <code>in</code> clause and required using <code>join</code> with that list.</p>
  
  <p>How to convert list (in the format that "in" can deal with) to something that can be joined.</p>
  
  <p><strong>Important constraint:</strong> I don't have writing permissions in the database so answers like "<em>write this list into new table and then join them</em>" - don't help me. Generally, I need to use this practice hundreds times in the code, so create a new table for every query not feasible even I have writing permissions.</p>
  
  <p>Can you help me, please? </p>