insert into ageData (PatientID, Age)
select PatientID from AEDepartment,
select DATEDIFF(hour,DOB,GETDATE())/8766 from AEDepartment;
错误讯息:
Incorrect syntax near the keyword select
答案 0 :(得分:4)
你应该只有一个SELECT
声明。
INSERT INTO ageData (PatientID, Age)
SELECT PatientID, DATEDIFF(hour,DOB,GETDATE())/8766
FROM AEDepartment