gpt4 book ai didi

jquery - mysql使用like操作报错

转载 作者:行者123 更新时间:2023-11-30 00:05:33 26 4
gpt4 key购买 nike

我正在执行 SQL 查询。

我的 table

   __________________________
| col1 |
---------------------------
| data for hello user |
| data |
-----------------------------

当我执行查询时

Select *
from table
where col1 like '%data for hello user admin%'

它没有提供任何数据

我的表包含数据您好用户的数据,但我想如果使用您好用户管理员的数据它还为我提供了与您好用户的数据相同的数据。

这可能吗?我该怎么做。

最佳答案

您可以使用 substr 来获取 col1 包含的精确长度

select * form `table` where `col1` like CONCAT( SUBSTRING(  'data for hello user admin', 0, LENGTH(  `col1` ) -1 ) ,  '%' ) 

关于jquery - mysql使用like操作报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24593532/

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