How to perform a Database API Inner query I have this Database API code, and I'm trying to add a sub-query to it: 

$query = db_select('' . $base_table . '', 'n')
      -&gt;extend('PagerDefault');
      -&gt;extend('TableSort');


to turn this:

SELECT 
FROM 
taxonomy_term_data n
ORDER BY n.tid ASC


Into this:

SELECT 
FROM 
(SELECT * taxonomy_term_data LIMIT 10) n
ORDER BY n.tid ASC


I've tried passing a db_select statement into another db_select statement. I've tried query->addExpression() and db_query() to no avail.
You Can refer to this link 

However you can try like below 

$query-&gt;condition('&lt;condition&gt;', $subquery);