I've been looking into the REGEXP when filtering my entries in my database.
I have a columns with values separated by commas looking like:
id col A
|---|------------------------|
| 1 | P:1,P:2,P:5,P:7 |
| 2 | P:6,P:8,P:10,P:11 |
| 3 | P:4,P:3,P1,P:0 |
| 4 | P:2,P:1 |
|---|------------------------|
Let's say I want the rows containing the value P:1, how can i design a REGEXP in the form:
SELECT * FROM `table` WHERE `col A` REGEXP '?'
so that i get rows 1 3 and 4? My previous approach was simply to use:
SELECT * FROM `table` WHERE `col A` LIKE 'P:1'
However that would naturally also return row 2 because it technically contains P:1...
Any help would be appreciated, I thinking this problem is fairly simple for a regexp expert!
Cheers,
Andreas