how do i use subquery in db_api condition?
If I understand you properly you need to use a standard where clause rather than a condition in your sub query, e.g.

$subquery = db_select('some_table_2');
$subquery-&gt;where('some_table_1.id = some_table_2.id');

...

$query-&gt;condition('some_table_1.something', $subquery);