specificId
field in tbl
, value like:
52890,56518,53034,53968,34830,30188,31311,31309,347,40340,31409,38334,37718,40654,26662,39016,26022,50740
These are csv format, how to use raw SQL to figure out, whether this record contains 52890
, so if it contains, sql it out, if not contains, I don't want to sql it out in result.
How to do this?
I can use PHP to make this, but it has a pagination problem, I have to make the page size correct, so must be done when I sql it, FYI, the PHP code I used is below:
if(isset($specificId) && is_numeric($specificId)) {
foreach($list as $k => $item){
$specificIdArr = explode(',', $item['specificId']);
if( !in_array($specificId, $specificIdArr) )
unset($list[$k]);
}
}
I've tried using find_in_set()
, it works, but a little problem, how to remove the result if this field is null
by using find_in_set()
.