Drupal Join Query with entityCondition I have two content type A and B in which B content type node is reference in A content type node. In B content type node there is status field. I want to fetch the A content type node in which the status of B content type node is something.

Can you please guide me how can I use this?

Thanks
This is the best solution for you ==> https://www.drupal.org/node/1343708

EFQ an beautifull tools for manipulate the entities in drupal.

Do not hesitate if you need precision but this doc is verry good.

In the Entity Reference case 

The column name for an entity reference field is target_id, so your code should be:

$query = new EntityFieldQuery();

$query
  -&gt;entityCondition('entity_type', 'node', '=')
  -&gt;propertyCondition('type', 'custom_node_type', '=')
  -&gt;fieldCondition('field_reference_name', 'target_id', $id, '=');

$entities = $query-&gt;execute();


For follow the relation of your entities you need to reference the A into B or B into A with a reference field. When you use EFQ to search the relation in node A with B you need to use fieldCondition in this reference field in my example is field_reference_name. If you list the content B (ids) into an array and you user this

$query = new EntityFieldQuery();

$query
  -&gt;entityCondition('entity_type', 'node', '=')
  -&gt;propertyCondition('type', 'a', '=')

$entities_a = $query-&gt;execute();


For search the relation A to B into A you need to use this : 

$query = new EntityFieldQuery();

$query
  -&gt;entityCondition('entity_type', 'node', '=')
  -&gt;propertyCondition('type', 'b', '=')
  -&gt;fieldCondition('field_reference', 'target_id', $entities_a, 'IN');

$entities_b_refered_into_a = $query-&gt;execute();


Good chance.