I have a table name tenders which contains the detail like:
+-------------------------------+
| id | Sector |
+-------------------------------+
| 1 | 1,3,5,9,7 |
+-------------------------------+
| 2 | 2,6,4,7,9,20 |
+-------------------------------+
| 3 | 1,2,3,55,47,52 |
+-------------------------------+
| 4 | 51,2,36,5,4,9,1 |
+-------------------------------+
I used the REGEXP
to find the values using mysql
SELECT * FROM `tenders` WHERE sector REGEXP "[[:<:]]1[[:>:]]"
and to set or
condition I use
SELECT * FROM `tenders` WHERE sector REGEXP "[[:<:]](1|2)[[:>:]]"
but I want to write a query where sector field neither exist 1
nor 2
. output should contain sector every other sector except 1
and 2
.