gpt4 book ai didi

mysql - 两个表之间的查询

转载 作者:行者123 更新时间:2023-11-29 21:59:22 25 4
gpt4 key购买 nike

这是我的带有 2 个参数的查询。有人可以帮我吗?

sql = "select * 
from studentlist
where firstname like '%"
& Transaction.SEARCHSTUDENT.Text
& "%' or studentnum like '%"
& Transaction.SEARCHSTUDENT.Text
& "%' and not in (select studentnum from borrowing of books where status ='borrowed')"

最佳答案

如果 borrowing of books 是您的表名(带有空格),则应使用反引号将其括起来,如下所示:

`borrowing of books`

编辑:此外,您的 where 子句中似乎缺少 studentnum ,因此它实际上应该如下所示:

sql = "select * 
from studentlist
where (firstname like '%"
& Transaction.SEARCHSTUDENT.Text
& "%' or studentnum like '%"
& Transaction.SEARCHSTUDENT.Text
& "%') and studentnum not in (select studentnum from `borrowing of books` where status ='borrowed')"

关于mysql - 两个表之间的查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32806253/

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