tags:

views:

3367

answers:

2

I have a column that has comma separated data:

1,2,3
3,2,1
4,5,6
5,5,5

I'm trying to run a search that would query each value of the CSV string individually.

0<first<5   and  1<second<3  and  2<third<4

I get that I could return all queries and split it myself and compare it myself. I'm curious if there is a way to do this so mysql does that processing work. Thanks!

+2  A: 

Hi

String split function is absent in MySQL. You can draft a function of your own. Please check this link http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/

cheers

Andriyev
+1  A: 

You may get what you want by using the MySQL REGEXP or LIKE.

See the MySQL Docs on Pattern Matching

Damo