gpt4 book ai didi

mysql - MySQL :how to use Wildcard in Subquery?

转载 作者:太空宇宙 更新时间:2023-11-03 12:33:33 25 4
gpt4 key购买 nike

例子:

SELECT country 
FROM data
WHERE city LIKE
(SELECT LEFT ('jakartada',7));

它工作得很好,但如果我给定界符值:4,我必须给通配符像这样 ---> "%string%",我可以在查询中提供通配符的地方?

最佳答案

使用 LIKE,您可以在模式中使用以下两个通配符。

Character   Description
% Matches any number of characters, even zero characters
_ Matches exactly one character
\% Matches one “%” character
\_ Matches one “_” character

这个查询对您有帮助吗?

SELECT country 
FROM data
WHERE city LIKE CONCAT ('%', (SELECT LEFT ('jakartada',7)), '%');

关于mysql - MySQL :how to use Wildcard in Subquery?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14316007/

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