mysql 如何判断一个字段包被含于另一个字符串中

1,663次阅读
没有评论

对于这个问题,大家可以find_in_set函数,可以很好的解决。

 

$sql="select * from ".tablename('weh5app_bobing_records')." where weid=".$_W['uniacid'];
		$sql_count="select count(*) from ".tablename('weh5app_bobing_records')." where weid={$_W['uniacid']}";
		if(!empty($openid_str))
		{
			//$sql.=" and '".$openid_str."' like concat('%', openid, '%')";
			//$sql_count=" and '".$openid_str."' like concat('%', openid, '%')";
			$sql.=" and find_in_set(openid,'".$openid_str."')";
			$sql_count.=" and find_in_set(openid,'".$openid_str."')";
		}
正文完
 

公众号