MySQL query finding values in a comma separated string
I have a field coursecode (varchar(50)) in a my table pcp that contains a comma delimited string such as .1,2,5,12, 15 Each number representing the available courses. When running the query select * from pcp where coursecode like '%1%' to get all the coursecode (coursecode=1), I also get the course who's code is xyz (=12) and abc(=15). How should I rewrite the query so that is selects ONLY the coursecode 1 and not all coursecode containing the number 1?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh KumarRank #91 · 22.9K reputationPosted Sep 1, 2018, 6:58 AM EDT