Deletion of some watchdog messages with subquery
You were close; this should work for you:

$subquery = db_select('watchdog', 'w')
  -&gt;fields('w', array('wid'))
  -&gt;condition('type', 'blabla')
  -&gt;range(0, 250)
  -&gt;execute()
  -&gt;fetchCol('wid');

// Deletes the previous selected values.
db_delete('watchdog')
  -&gt;condition('wid', $subquery, 'IN')
  -&gt;execute();


You weren't executing the subquery (meaning there were no results), and you mixed up the order of arguments passed to query condition.