gpt4 book ai didi

php - 如何在mysql中实现 'like'和 'in'

转载 作者:可可西里 更新时间:2023-11-01 07:54:18 25 4
gpt4 key购买 nike

我有搜索项,例如 '%ab''%avcd%'%sr%'' %pple%' 在我的 PHP 变量中。我知道 LIKE 在 MySQL 中用作:

Select * from tblName where fieldname like '%ab'

如前所述,我有一长串搜索条件,我知道

Select * from tblName where fieldname like in ('%ab','%avcd%','%sr%','%pple%')

没用。解决问题的最佳方法是什么?

最佳答案

SELECT * from tblName where fieldname REGEXP 'ab|avcd|sr|pple';

关于php - 如何在mysql中实现 'like'和 'in',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8075774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com