How to use a value in WHERE clause from a comma separated string in a MySQL Table? -
how records table contains 24 deptid. i've added table structure. sql query id , name contains 24 deptid?
users: ------ id name deptid --- ----- ------- 1 balaji 1,136,12,53,48,2,153,45,78,53,10,3,143,53,46,49 2 scott 24,90,120 3 balraj 43,9,24,901
we can use find_in_set function in mysql.
$deptid="24";
query is
select * users find_in_set('$deptid', deptid);
Comments
Post a Comment