BS-11476, fix wrong query (was missing parentheses) - Query tests added.