Friday, February 26, 2010

, and ,! operators in query ranges

If a query range value is "A,B" it will be translated into the SQL expression (ItemId='A') OR (ItemId='B'), so both items with ID A and B will be selected. If a query range is "!A" than it will be translated into SQL expression NOT (ItemId='A'), so items with ID not equal to A will be selected. But, if a query range is "A,!B" it will be translated not into (ItemId='A') OR NOT (ItemId='B') as it seems to be correct. It will be translated into (ItemId='A') AND NOT (ItemId='B'). Despite that such behavior looks strange it seems to be a feature, not a bug. So it is just better to understand "," and ",!" as different operators - OR and AND NOT.