How can I get only those entries with non-empty assets field Since Craft 2.0 it is possible to pass :empty: and :notempty: to ElementCriteriaModel parameters when you’re looking for empty/non-empty values. If you are for example looking for all entries with a non-empty text field myTextField, you can do this:

{% set entries = craft.entries.section('mySection').myTextField(':notempty:') %}


However this syntax doesn't work for asset fields and I can't figure out how that syntax has to be.

An alternative would be to use the search function:

{% set entries = craft.entries.section('mySection').search('myAssetField:*') %}


But I generally try to avoid using the search parameter in queries whenever possible. It is probably not that much of a performance killer but by avoiding it I don't have to worry about my search index.﻿
Craft 2.5 introduced a new feature for this.


  It’s now possible to find elements where a relational field does/doesn’t have any related elements, by passing ':notempty:' or ':empty:' onto the field’s ElementCriteriaModel parameter (e.g. craft.entries.myEntriesField(':notempty:')).


So in this case you can use:

{% set entries = craft.entries.myAssetField(':notempty:') %}