gpt4 book ai didi

mysql 查询返回零行

转载 作者:行者123 更新时间:2023-11-29 12:02:37 24 4
gpt4 key购买 nike

这是我的查询,它使用姓名或电话号码从数据库中搜索学生。

select ct.id, c.name as batchname,ct.qualification,ct.fees,ct.email,
ct.email,ct.phone, ct.name, ct.status,ct.notification
from student ct , batch c
where ct.batch_id=c.id and c.status=1
and (ct.name like '%Aniruddha%' or ct.phone like '%Aniruddha%')

问题是,如果学生是,它将获取零行表单数据库存在于数据库中。我无法识别查询中的错误是什么任何人都可以提供帮助。

最佳答案

请尝试这个:

select ct.id, c.name as batchname,ct.qualification,ct.fees,ct.email,
ct.email,ct.phone, ct.name, ct.status,ct.notification
from student ct
left join batch c on ct.batch_id=c.id
where c.status=1
and (ct.name like '%Aniruddha%' or ct.phone like '%Aniruddha%')

关于mysql 查询返回零行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32118354/

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