Sort an entity query by a term reference field's term weight? I've created an entity query to get an array of nodes based on a specific content type,see below:

$query = new EntityFieldQuery();        
$query-&gt;entityCondition('entity_type', 'node');
$query-&gt;entityCondition('bundle', 'article');
$query-&gt;propertyCondition('status', 1, '=');
$result = $query-&gt;execute();    
$nodes = node_load_multiple(array_keys($result['node']));


The node content type article being queried has a Term Reference field (list of tags). Each taxonomy term is sorted via the admin/structure/taxonomy/tags administration screen.

I have the requirement to have the nodes sorted by term weight. For example the nodes that reference the highest weighted taxonomy term will be at the top.

Is there a way to add a relationship to the taxonomy table using EntityQuery, or is there another way to do this?
Since the weight is kept in a different table than the one that stores the data related to your node, I'm afraid this is impossible using EntityFieldQuery. You'll have to do some custom coding after the query.

By the way, to use data from the reference field (field_data_your_reference) you could use a fieldCondition or fieldOrderBy.