EntityFieldQuery: number of field values as condition I have a node type which has a field that can contain an unlimited amount of images.

I want to retrieve a set of entities, but only entities that contain at least one image.

So far this is my query:

$result = $query-&gt;entityCondition('entity_type', 'node')
    -&gt;entityCondition('bundle', 'reference')
    -&gt;propertyCondition('promote', 1)
    -&gt;propertyOrderBy('created', 'DESC')
    -&gt;pager(12)
    -&gt;execute();


How should I use the extra fieldCondition to indicate I only want nodes with at least 1 value for field_images?
Seems like stating the obvious but you need to count the number of values in 'field_images', then you can set the condition to check that result and make sure it is greater than 0.

There's a good overview of adding expressions and conditions with the count() function on this question.

You'll also need to perform a join between 'node' and the table that holds your field values before you make your count, something like this:

$query = db_select('node', 'n');
$query-&gt;join('field_images', 'fi', 'n.nid = fi.nid');
...rest of query