简体   繁体   中英

insert query isn't working

在此处输入图片说明

INSERT INTO EmployeePrivileges (EmployeeID, PrivilegeID)
VALUES (
(SELECT ID
FROM Employees
WHERE Employees.JobTitle = 'Sales Manager'), 
(SELECT PrivilegeID
FROM Privileges
WHERE Privileges.PrivilegeName = 'Day opening and closing'));

I'm trying to run the above query in Ms Access but following error occurs " error query input must contain at least one table or query" what to do?

I haven't used ms-access in some time, but as long as those 2 queries are just returning 1 row each you could combine them:

INSERT INTO EmployeePrivileges (EmployeeID, PrivilegeID)
    SELECT e.ID, p.PrivilegeID
     FROM Employees e, Privileges p
    WHERE e.JobTitle = 'Sales Manager'
      AND p.PrivilegeName = 'Day opening and closing';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM