So I have a query where I am attempting to obtain rows that contain the words citalopram or the word celexa either in the medication column or in the generic column.
First I tried:
where
( medication ilike '%citalopram%' or
generic ilike '%citalopram%' or
medication ilike '%celexa%' or
generic ilike '%celexa%')
And all was find and dandy, except, it also selected rows that contained the medication escitalopram. So I changed the query so that it looked like the following:
where
( medication ilike '%citalopram%' or
generic ilike '%citalopram%' or
medication ilike '%celexa%' or
generic ilike '%celexa%') and
medication not ilike '%escitalopram%' and
generic not ilike '%escitalopram%'
Now, sure enough it eliminates the rows containing escitalopram, but now sometimes neglects rows that have:
- medication=
CeleXa 40mg oral tablet, generic=null - medication=
citalopram 40mg oral tablet, generic=null
etc.
Not sure why this might be the problem. Any suggestions will be appreciated!