Entityfield query

Entityfield query

This class is a mechanism for quickly building queries of entities and fields - typically nodes, but of course not limited to that.
Drupal 7 features a much richer database abstraction layer than previous versions of Drupal, but in the end you are still more or less building SQL. 

http://treehouseagency.com/blog/tim-cosgrove/2012/02/16/entityfieldquery...