```
product_id |value
1          | a
1          | b
1          | c
2          | a
2          | c
2          | d
3          | a
3          | c
3          | d

```

Below is my code, what I am trying to achieve with it is to check which product\_id's have both 'a' and 'c' -that part works fine.

My problem is that when i do the following:

```
AND value != ('b')

```

It completely ignores the not equal to operator and still returns b...

```
SELECT 
    product_id, value
FROM
          table
WHERE
    value = 'a'
    OR value = 'c'
    AND value != ('b')
GROUP BY product_id
HAVING count(value) = 2
order by product_id

```

I guess my question is how do I fix it and why is this happening? thank you very much for your time. :)

EDIT:
What I should achieve is :

```
product_id  value
2   a
3   a

```