searching a substring within a set of string in mysql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
basudeb
Forum Commoner
Posts: 44
Joined: Wed Dec 20, 2006 12:13 am

searching a substring within a set of string in mysql

Post by basudeb »

Suppose i have a table customer with fields (id(primary key, auto incremented),name ,......., employee_id). and the data type of the field employee_id is text . Suppose the records are like :

1,'basudeb', . ..,.., '6,7,8,10,11' ;
2,'sumon', ..., '10,12,14,15,16' ;
3,'mithun',...,...,' 7,8,11,10' ;
4,'arun',....,..,'10' ;
5,'barun',.., ..,'10,11';
6,'Jon', ...., ...,'11,10,8,7,6';

Now i want to get the records where 10 is presents as employee_id.
I have used the in operator but it returns the records where 10 is presents at first. please give suggestion.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: searching a substring within a set of string in mysql

Post by Ollie Saunders »

Try the ORDER BY clause
Post Reply