Simple AND Query in OQL not working

0
Hi all, I have a entity called attribute  which will have a attribute called AttributeValue and AttributeName as below: I have a data for the entity as below :   What I am trying is a simple select statement as below: SELECT * FROM ClassificationUser.Attribute as attribute Where (attribute/AttributeName= 'Thread Description' AND attribute/AttributeValue = 'VAM TOP HT') and (attribute/AttributeName= 'Thread Size' AND attribute/AttributeValue = '7') What I expect is to return both 'Thread Description' and 'Thread Size' rows. But it is returning empty. I don’t want to use or condition as I want all the conditions to match not either one. Please help me.I am confused on what is the issue
asked
1 answers
0

That's because of the and between the two clauses.

It should be:

SELECT * FROM ClassificationUser.Attribute as attribute
Where (attribute/AttributeName= 'Thread Description' AND attribute/AttributeValue = 'VAM TOP HT')
OR (attribute/AttributeName= 'Thread Size' AND attribute/AttributeValue = '7')

When you put an AND there, both conditions should be true for each record, which is never the case.

answered