I'm having a bit of an issue trying to query a table. I'm trying to query all the usersid that has multiple colors. So I expect the results to be just 222 because it has red and blue values.
I have tried:
SELECT userid FROM test_table WHERE color = 'red' AND color = 'blue';
SELECT userid FROM test_table WHERE color LIKE '%red%' AND color LIKE '%blue%';
I tried using or for both of these queries but they return everything.
| userid | color |
+--------+-------+
| 222 | red |
| 222 | red |
| 333 | red |
| 333 | red |
| 222 | blue |
| 444 | blue |