我正在尝试将 Access INSERT 查询转换为 MySQL 直通查询,但对 MySQL 不是很熟悉。我知道我的语法不正确,但我不知道到底是什么问题。
访问版本:
INSERT INTO [tblHistoryThruToday RETAIN-STU-ADVISOR] ( [STUDENT ID], [ADVISOR ID], [COURSE TERM], [BLANK ADV TERM], [BLANK ADV TYPE], [BLANK DEPARTMENT], [BLANK PRIMARY ID], SOURCEFILE, [TIMESTAMP] )
SELECT [tblHistory - RETAIN-STU-ADVISOR].[STUDENT ID], [tblHistory - RETAIN-STU-ADVISOR].[ADVISOR ID], [tblHistory - RETAIN-STU-ADVISOR].[COURSE TERM], [tblHistory - RETAIN-STU-ADVISOR].[BLANK ADV TERM], [tblHistory - RETAIN-STU-ADVISOR].[BLANK ADV TYPE], [tblHistory - RETAIN-STU-ADVISOR].[BLANK DEPARTMENT], [tblHistory - RETAIN-STU-ADVISOR].[BLANK PRIMARY ID], [tblHistory - RETAIN-STU-ADVISOR].SOURCEFILE, [tblHistory - RETAIN-STU-ADVISOR].TIMESTAMP
FROM [tblHistory - RETAIN-STU-ADVISOR];
我对 MySQL 的尝试(我的表名两侧都有 ` 标记,但您可能无法在预览中看到它们)
INSERT INTO `tblHistoryThruToday RETAIN-STU-ADVISOR` (‘STUDENT ID’, ‘ADVISOR ID’,’COURSE TERM’, ‘BLANK ADV TERM’,’BLANK ADV TYPE’, ‘BLANK DEPARTMENT’, ‘BLANK PRIMARY ID’, ‘SOURCEFILE’, ‘TIMESTAMP’ )
SELECT `tblHistory - RETAIN-STU-ADVISOR`.‘STUDENT ID’, `tblHistory - RETAIN-STU-ADVISOR`.‘ADVISOR ID’, `tblHistory - RETAIN-STU-ADVISOR`.‘COURSE TERM’, `tblHistory - RETAIN-STU-ADVISOR`.‘BLANK ADV TERM’, `tblHistory - RETAIN-STU-ADVISOR`.‘BLANK ADV TYPE’, `tblHistory - RETAIN-STU-ADVISOR`.‘BLANK DEPARTMENT’, `tblHistory - RETAIN-STU-ADVISOR`.’BLANK PRIMARY ID’, `tblHistory - RETAIN-STU-ADVISOR`.‘SOURCEFILE’, `tblHistory - RETAIN-STU-ADVISOR`.‘TIMESTAMP’
FROM `tblHistory - RETAIN-STU-ADVISOR`;