How do I compare a field of a node with all nodes of a content type with rules? In Rules on Drupal 7, how do I set up a rule / ruleset so when a node is saved compares a textfield from the saved node with a textfield in all nodes of a content type and if match, not the saved node but the matching node should be unpublished?
I haven't found a solution using only rules yet, maybe it would be possible with rules and views bulk operations (vbo)? A custom module is what I did to solve it (thanks Oleg for pointing me to EntityFieldQuery). Here is the code:

&lt;?php

/**
 * @file
 * custom_unpublish.module
 *
 * This module compares a field in a node when updated with a field in all 
 * nodes of a content type and if match, the matching nodes is unpublished
 */

function custom_unpublish_node_update($node) {
  // Only check nodes of a certain content type
  if ($node-&gt;type == 'article') {
    $wrapper = entity_metadata_wrapper('node', $node);

    // Get the wanted field
    $id = $wrapper-&gt;field_id-&gt;value();

    $query = new EntityFieldQuery();

    // Check only a certain content type (bundle) and make a fieldCondition
    $query-&gt;entityCondition('entity_type', 'node')
    -&gt;entityCondition('bundle', 'accepted_article')
    -&gt;propertyCondition('status', 1)
    -&gt;fieldCondition('field_id', 'value', $id, '=');
    $result = $query-&gt;execute();

    if (isset($result['node'])) {
      $result_items_nids = array_keys($result['node']);
      $result_nodes = node_load_multiple($result_items_nids);
      foreach ($result_nodes as $result_node) {
        // Unpublish the node
        $result_node-&gt;status = 0;
        node_save($result_node);
        watchdog('custom unpublish', 'Match for ' . $id . '. ' . $result_node-&gt;title . ' was unpublished.');
      }
    }
  }
}