2

I wanna use a between operator. Can anyone tell how to use this? I am using it like this

$query->propertyCondition('nid', array(4, 3), 'between');

But it is also including node id 4 and 3, and I want to show only "2", which falls in between. How can this be done?

1
  • 2
    $query ->propertyCondition('nid', 1, '>') ->propertyCondition('nid', 3, '<');
    – DRUPWAY
    Commented Aug 27, 2015 at 15:16

1 Answer 1

2

If you want to include 2 then simply pass 2.

$query->propertyCondition('nid', array(2));

While using between operator, it includes the range values too. So you can just pass the range values you want to include. Still if you want to exclude these range then add one more condition like :

$query->propertyCondition('nid', array(1, 3), 'BETWEEN'); // 1, 3 to get the nid 2
$query->propertyCondition('nid', array(1, 3), 'NOT IN'); // exclude these nids

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.