gpt4 book ai didi

MySQL显示零结果时有一些?

转载 作者:行者123 更新时间:2023-11-29 12:48:06 25 4
gpt4 key购买 nike

我有一个如下表:

id | description | db_url | form_url | user | projectid

2 | nailbar | TSF/nailbar/index.php | TSF/nailbar/upload.php | test_user | 2

1 | jewellery | TSF/jewellery/index.php | TSF/jewellery/upload.php | test_user | 1

1 | jewellery | TSF/jewellery/index.php | TSF/jewellery/upload.php | test_user2 | 1

3 | locker | TSF/locker/index.php | TSF/locker/upload.php | test_user | 3

当我执行以下查询时,没有任何结果:

SELECT * 
FROM projects
JOIN member_projects ON member_projects.projectid = projects.id
WHERE user = 'test_user'
AND db_url = 'TSF/locker/index.php'
LIMIT 0 , 30

显然存在匹配,所以我不明白为什么它会得出零结果?

最佳答案

当字符串的开头或结尾有额外的字符时,通常会发生这种情况。最有可能的罪魁祸首是网址。您可以尝试:

SELECT * 
FROM projects p JOIN
member_projects mp
ON mp.projectid = p.id
WHERE user = 'test_user' AND
trim(db_url) = 'TSF/locker/index.php'
LIMIT 0 , 30;

如果上述方法不起作用,您还可以查找“包含”而不是完整匹配项:

SELECT * 
FROM projects p JOIN
member_projects mp
ON mp.projectid = p.id
WHERE user = 'test_user' AND
db_url like '%TSF/locker/index.php%'
LIMIT 0 , 30;

关于MySQL显示零结果时有一些?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25160887/

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