title: Sequelize: Use query results as table for selectQuery
body: <p>Is it possible to use the results of a query as a table for another select in sequelize's query generator? Here's the SQL I'm trying to get generated:</p>
  
  <pre><code>UPDATE target 
  SET fk1_id = '1' 
  WHERE id NOT IN
      (SELECT id
      FROM (
          SELECT id
          FROM target
          WHERE fk1_id = 1 AND fk2_id = 2
           ) AS inner_target )
      AND fk1_id IS NULL AND fk2_id = '2' LIMIT 1
  </code></pre>
  
  <p>and I'm trying to accomplish this with:</p>
  
  <pre><code>const innerSelect = 
  sequelize.dialect.QueryGenerator.selectQuery('target', {
              attributes: ['fk1_id'],
              where: {
                  fk1_id: fk1_id,
                  fk2_id: fk2_id,
              },
          }).slice(0, -1);
  
  const selectAs = sequelize.dialect.QueryGenerator.selectQuery(
      sequelize.literal(`${innerSelect}`), {
              attributes: ['id'],
          }).slice(0, -1);
  </code></pre>
  
  <p>however, I get an error saying:</p>
  
  <pre><code>"message": "Table 'db.undefined' doesn't exist"
  "name": "SequelizeDatabaseError"
  "code": "ER_NO_SUCH_TABLE"
  </code></pre>
  
  <p>and the inner select is trying to select from <code>undefined</code></p>
  
  <p>any suggestions would be greatly appreciated!</p>