我目前正在尝试将数据输入到我的一个表中,但链接到数据库中的另一个表,下面的代码是我发现的内容,但始终输入null,我丢失了什么或者我做错了什么?

INSERT INTO VOLUNTEER(VOLUNTEERID,membershipid,MEMBERNAME,MEMBERDAYTIMENO)
VALUES (1,
       (SELECT MEMBERSHIPID FROM MEMBERSHIP WHERE MEMBERNAME = 'FRANCES'),
       (SELECT MEMBERNAME FROM MEMBERSHIP WHERE MEMBERNAME = 'FRANCES'),
       (SELECT MEMBERDAYTIMENO FROM MEMBERSHIP WHERE MEMBERNAME ='FRANCES')
);


我正在使用Oracle SQL数据库。

最佳答案

INSERT INTO VOLUNTEER(VOLUNTEERID, membershipid, MEMBERNAME, MEMBERDAYTIMENO)
   SELECT                       1, MEMBERSHIPID, MEMBERNAME, MEMBERDAYTIMENO
      FROM MEMBERSHIP WHERE MEMBERNAME = 'FRANCES';

关于mysql - 如何从已创建的表中将数据插入Oracle SQL Developer中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27507170/

10-09 14:13