Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional count with OR

What is the correct syntax to count instances of two filters using an OR?

Basically I need to count:

Count ( {<BLOB={'>0'}>} DISTINCT DeviceID ) + Count ( {<FOO={'>0'}>} DISTINCT DeviceID ), but then their might be repeated DeviceID's for devices that have both BLOB and FOO.

So, looking for something like this:

Count ( {<BLOB={'>0'} or FOO={'>0'} >} DISTINCT DeviceID )

Count ( {<BLOB={'>0'} || FOO={'>0'} >} DISTINCT DeviceID )

1 Solution

Accepted Solutions
Nicole-Smith

Count ({<BLOB={'>0'}>+<FOO={'>0'}>} DISTINCT DeviceID )

From QV Help:

Set Operators

Several set operators that can be used in set expressions exist. All set operators use sets as operands, as described above, and return a set as result.

+ Union. This binary operation returns a set consisting of the records that belong to any of the two set operands.

- Exclusion. This binary operation returns a set of the records that belong to the first but not the other of the two set operands. Also, when used as a unary operator, it returns the complement set.

* Intersection. This binary operation returns a set consisting of the records that belong to both of the two set operands.

/ Symmetric difference (XOR). This binary operation returns a set consisting of the records that belong to either, but not both of the two set operands.

View solution in original post

2 Replies
Not applicable
Author

Hi Jessica,

try this:

Count ( {<BLOB={'>0'} + FOO={'>0'}>} DISTINCT DeviceID )


best regards

Nicole-Smith

Count ({<BLOB={'>0'}>+<FOO={'>0'}>} DISTINCT DeviceID )

From QV Help:

Set Operators

Several set operators that can be used in set expressions exist. All set operators use sets as operands, as described above, and return a set as result.

+ Union. This binary operation returns a set consisting of the records that belong to any of the two set operands.

- Exclusion. This binary operation returns a set of the records that belong to the first but not the other of the two set operands. Also, when used as a unary operator, it returns the complement set.

* Intersection. This binary operation returns a set consisting of the records that belong to both of the two set operands.

/ Symmetric difference (XOR). This binary operation returns a set consisting of the records that belong to either, but not both of the two set operands.