How to use multiple conditions on entity query together, for example using condition

condition('field_one', array('2'), 'IN') and condition('field_tow', array('2'), 'NOT IN') together ?

Somehow if you mention both separately it doesn't give desired output.

Comments

swarup.masurkar created an issue. See original summary.

rajanvalecha12’s picture

Provide more info on this.
It would be better if you provide the code snippet!

swarup.masurkar’s picture

$latestNode = \Drupal::entityQuery('node')
->condition('type', 'article')
->condition('status', 1)
->condition('nid', '5265', '!=')
->condition('field_one', array('2'), 'IN')
->condition('field_two', array('56'), 'NOT IN')
->sort('changed', 'ASC')
->range(0, 1)
->execute();

the IN and NOT IN conditions are not working properly together.

snehi’s picture

Status: Active » Closed (works as designed)

I think this is not the best place to put questions over here.
Please post your questions in Drupal forms or on IRC.