I’m using the following logic in my where statement.
If I do just the statement below then it returns results
where a.CONDITION_NAME like '%colon%' and a.STUDY_CRITERIA like '%braf%'
However if I expand on the where logic to the following statement it returns no results. Why? Shouldn’t it return the same thing as where statement above?
where a.CONDITION_NAME like '%colon%' and a.STUDY_CRITERIA like '%braf%' and (a.SHORT_TITLE like '%braf%' or a.STUDY_TITLE like '%braf%' or a.DESCRIPTION like '%braf%')
Basically what I want is the following. I need it to find records where the condition name is like colon and the study criteria field is like braf. But since there are other fields that can contain the braf term, I need it to search whether short title or study title or description contain the braf term as well. Is there a different way to code that up? This is done in pgadmin4 via postgreSQL
Advertisement
Answer
Following your explanation it should be
where a.CONDITION_NAME like '%colon%' and (a.STUDY_CRITERIA like '%braf%' or a.SHORT_TITLE like '%braf%' or a.STUDY_TITLE like '%braf%' or a.DESCRIPTION like '%braf%')