0

这是我的带有 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')"
4

1 回答 1

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')"
于 2015-09-29T10:00:34.773 回答