title: Check if entry exists in previous mysql query results
body: <p>I'm using MySQLdb with python.  I execute a SELECT query and store the results in a dictionary, D.  The actual query is quite complicated so it's not clear how to do it in a single query, which is why I'm splitting it into two.</p>
  
  <p>Then I run a second query and would like to add the condition that rows from columnB in the second query exist IN D.values(). ie, I'd like to do something like:</p>
  
  <pre><code>import MySQLdb
  db = MySQLdb.connect()
  cursor = db.cursor(MySQLdb.cursors.DictCursor)
  
  cursor.execute("SELECT a, b FROM t1;")
  results1 = cursor.fetchall()
  </code></pre>
  
  <h1>I'd like to do the following, somehow passing an array from a previous query's results into to SELECT command:</h1>
  
  <pre><code>cursor.execute("SELECT c, d FROM t2 WHERE d IN results1.b.values();")
  </code></pre>
  
  <p>Thank you,</p>