query condition comparing two fields i am having this query :

   $db = \Drupal::database();

  $exist_query= $db-&gt;select('user__roles', 'ur');
  $exist_query-&gt;fields('ur', ['entity_id']);
  $exist_query-&gt;condition('ur.entity_id','u.uid', '=');
  $exist_query-&gt;condition('ur.roles_target_id', $included_user_roles, 'IN');

  $not_exist_query= $db-&gt;select('user__roles', 'ur');
  $not_exist_query-&gt;fields('ur', ['entity_id']);
  $not_exist_query-&gt;condition('ur.entity_id','u.uid', '=');
  $not_exist_query-&gt;condition('ur.roles_target_id', $excluded_user_roles, 'IN');

  $query = $db-&gt;select('users_field_data', 'u');
  $query-&gt;fields('u', ['uid']);
  $query-&gt;condition('u.uid', 1, '&gt;');
  if (!empty($param['login_value'])) {
    $query-&gt;condition('u.login', $logindate, '&lt;');
    $query-&gt;condition('u.login', 0, '!=');
  }  
  $query-&gt;exists($exist_query);
  $query-&gt;notExists($not_exist_query);
  dpq($query);


the problem i am having is here 

  $exist_query-&gt;condition('ur.entity_id','u.uid', '=');


it generates :

WHERE (ur.entity_id = 'u.uid')


when it should

WHERE (ur.entity_id = u.uid)


How can i solve this ?

The working request i am trying to achieve

SELECT u.uid AS uid
FROM
users_field_data u
WHERE (u.uid &gt; '1') AND (u.login &lt; '1586705658') AND (u.login != '0') AND (EXISTS (SELECT ur.entity_id AS entity_id
FROM
user__roles ur
WHERE (ur.entity_id = u.uid) AND (ur.roles_target_id IN ('admin_site')))) AND (NOT EXISTS (SELECT ur.entity_id AS entity_id
FROM
user__roles ur
WHERE (ur.entity_id = u.uid) AND (ur.roles_target_id IN ('membre_du_site'))))
You can add such a clause manually:

$not_exist_query-&gt;where('ur.entity_id = u.uid');