Skip to content
Advertisement

I’m having this error in ms access query input must contain at least one table or query

I’m trying to insert single values from other tables but getting this error. If you know that how to fix then please fix mine code …

Check this:

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"
)

Advertisement

Answer

I’d try something like:

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

(But I don’t know your data. Will the select return one row?)

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement