Thread:Project:Support desk/Subquery in extension

What's the best method to run a subquery in an extension.

I got an extension that uses the externallinks table. The query looks like this:

$query = "`el_to` LIKE '%foo%'";

$res = $dbr->select(				'externallinks',				array( 'el_from', 'el_to', ),				array( $query ),				__METHOD__,				array( 'ORDER BY' => 'el_to DESC, el_from DESC', 'LIMIT' => $limit, 'OFFSET' => $offset, )		);

Now I want to exclude a custom namespace so I need to run a subquery for. Is there a function for it I could use?