How can I retrieve the 'count(*)' from a query in drupal 7? The query needs to include a custom content type and a custom field.
Custom Content Type: employees
Custom Field Name: field_employees_email
As a note, I'm looking to add
WHERE field_employees_email = 'email@example.com'
to the query...
So far, I have something like:
$query = new EntityFieldQuery; $result = $query ->entityCondition('entity_type', 'node') ->propertyCondition('status', 1) // Getting published nodes only. ->propertyCondition('type', 'employees') //Getting 'employees' type only. // How do I include custom field as part of query? ->execute();
Also, is there an easier way than
$total = count($result);
to return the COUNT(*) from the query?