How to query for entities without a value for a specific field? Using EntityFieldQuery it is pretty easy to query for entities with a given value for a specific field. But I fail to find a way to query for entities without a value for a given field. Let's say I have an optional Taxonomy Reference field on all my content type. I can query the nodes associated with a given taxonomy term using:  

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'file')
  -&gt;fieldCondition('field_tags', 'tid', $tid)
  -&gt;pager($limit);
$results = $query-&gt;execute();


But how would I query for all nodes not associated with any terms (ie. which have no value for the field_tags field). I tried setting $tid to NULL and $query-&gt;fieldCondition('field_tags', 'tid', $all_tids, 'NOT IN') without success.
The SQL implementation of EntityFieldQuery doesn't support this, because it builds the query using INNER JOINs instead of LEFT JOINs. I consider this a bug, please open an issue in the core queue.