Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将参数和列从表插入到一个表sql_Sql_Ms Access - Fatal编程技术网

将参数和列从表插入到一个表sql

将参数和列从表插入到一个表sql,sql,ms-access,Sql,Ms Access,使用MS Office 2019,我有两个表: tblPerson(idPerson,idCategory) 我要创建第二个表,其中包含: tblPersonByDate(idPerson,date_A) 插入tblPersonByDate(tblPerson.idPerson,@date\u A) 我的问题不起作用 INSERT INTO tblPersonByDate (idPerson,date_A) VALUES( (SELECT idPerson FROM

使用MS Office 2019,我有两个表:

  • tblPerson(idPerson,idCategory)
  • 我要创建第二个表,其中包含:
  • tblPersonByDate(idPerson,date_A)
  • 插入tblPersonByDate(tblPerson.idPerson,@date\u A)
我的问题不起作用

INSERT INTO tblPersonByDate (idPerson,date_A)
VALUES( (SELECT idPerson 
         FROM tblPerson
         )
         , @date__A)

正如我从问题中了解到的,日期来自sql参数 您可以使用insert into table from select语句

insert into tblPersonByDate(idPerson, date_A)
select idPerson  ,@date_A From tblPerson

这个日期从哪里来?插入t2选择id。。。从t1…插入tblPersonByDate(tblPerson.idPerson,@date\u A)您尝试了什么?正如@Mureinik提到的,这个日期从哪里来?@date\u是一个参数,你不了解什么。tblPerson的第一列(idPerson)和第二列(date_A)是参数输入手册
INSERT INTO tblPersonByDate (idPerson,date_A)
VALUES( (SELECT idPerson 
         FROM tblPerson
         )
         , @date__A)
insert into tblPersonByDate(idPerson, date_A)
select idPerson  ,@date_A From tblPerson