这是我的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')"
答案 0 :(得分:0)
如果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')"