我在ms access查询输入中出现了这样的错误,必须至少包含一个表或查询。

问题描述 投票:0回答:1

我试图从其他表中插入单个值,但得到这个错误。如果你知道如何修复,然后请修复我的代码... ...

检查这个。

INSERT INTO Library_Records_DB(Book_Name, Student_Roll_Num, Student_Name, Student_Department, Lending_Date)
values
(
"English", 
747, 
(select Full_Name from GCUF_Students_DB_Morning where Roll_Num=747), 
(select Department from GCUF_Students_DB_Morning where Roll_Num=747), 
"01-jan-2020"
)

sql ms-access sql-insert ms-access-2016
1个回答
3
投票

我可以试试这样的方法。

INSERT INTO Library_Records_DB
    (Book_Name, Student_Roll_Num, Student_Name, Student_Department, Lending_Date)
select "English", Roll_Num, Full_Name, Department, "01-jan-2020"
from GCUF_Students_DB_Morning
where Roll_Num=747

(但我不知道你的数据,选择会不会只返回一行?)

© www.soinside.com 2019 - 2024. All rights reserved.