title: How to use a list/array of values as column name in select statement?
body: <p>Say I have 3 list of data that I am using to build a new query. I need to take these list of data and return the values of those list where things were found.</p>
  
  <p>So my question is this:</p>
  
  <blockquote>
    <p>Is there a standard method of taking a list and using it as a column?</p>
  </blockquote>
  
  <p>I will need to use multiple list as columns where one column is the "JOIN ON" or "WHERE IN" portion.</p>
  
  <p>The results from my first query are used to build my 3 list.</p>
  
  <p>Say I get back this data:</p>
  
  <pre><code>[[ID, TYPE, OTHER],
   [1, C, S], 
   [2, C, O],
   [3, D, D],
   [4, D, H]]
  </code></pre>
  
  <p>Then convert that table/2D Array to the following Python List:</p>
  
  <pre><code>[1, 2, 3, 4]
  [C, C, D, D]
  [S, O, D, H]
  </code></pre>
  
  <p>Now I want to use those 2 list as columns in a select statement like this:</p>
  
  <pre><code>select [C, C, D, D] as TYPE # These 2 list are needed to return in the correct order
        ,[S, O, D, H] as OTHER  # as it relates to [1, 2, 3, 4] in the WHERE.
        ,table.value
        ,table.color
  From table
  where table.value in [1, 2, 3, 4]  # one list is used to deal with the where 
  </code></pre>
  
  <p><code>table</code> contains 2 columns:</p>
  
  <pre><code>VALUE    COLOR
  1        Red
  2        Green
  3        Blue
  4        Black
  </code></pre>
  
  <p>Results should look like this:</p>
  
  <pre><code>TYPE    OTHER    VALUE    COLOR
  C       S        1        Red
  C       O        2        Green
  D       D        3        Blue
  D       H        4        Black
  </code></pre>