title: Using select query for IN Clause, along with hardcoded values
body: <p>I have some code where I am selecting rows that have any of the following hardcoded <code>SETID</code> values. This is part of additional code being rolled into a SQL View.</p>
  
  <pre><code>SELECT *
  FROM TEST_TABLE1 B
  WHERE B.SETID IN ('11000', '18000', '41000', '41001')
  </code></pre>
  
  <p>In addition to the above hardcoded values, I would like to add in another much longer list of <code>SETID</code>'s between the range <code>'90000' and '90999'</code> that are contained in a table <code>PS_LOC_GL</code>. I would prefer to use the <code>BETWEEN</code> operator, so that I don't have to list out each value in this range. I haven't been able to find a method to select both the hardcoded values, and use a <code>BETWEEN</code> operator together.</p>
  
  <p>This is what I have come up with so far, however I don't believe I can use variables inside SQL views, so while this works as native SQL code, it will not work inside my view:</p>
  
  <pre><code>DECLARE @SET_ID_LIST table (SETID varchar(5))
  INSERT @SET_ID_LIST(SETID) VALUES ('11000'), ('18000'), ('41000'), ('41001');
  
  SELECT *
  FROM TEST_TABLE1 B
  WHERE B.SETID IN (
      SELECT SETID FROM @SET_ID_LIST 
      UNION
      SELECT SETID FROM PS_LOC_GL
  )
  </code></pre>
  
  <p>Are there any other options I have where I can use both the hardcoded list of values, along with more of a dynamic list based on the <code>PS_LOC_GL</code> table that only has <code>SETID</code> values in the <code>'90000'</code> to <code>'90999'</code> range.</p>