以下代码有什么问题?

时间:2013-01-20 05:05:19

标签: sql syntax

insert into ageData (PatientID, Age) 
select PatientID from AEDepartment, 
select DATEDIFF(hour,DOB,GETDATE())/8766 from AEDepartment;

错误讯息:

Incorrect syntax near the keyword select

1 个答案:

答案 0 :(得分:4)

你应该只有一个SELECT声明。

INSERT INTO ageData (PatientID, Age) 
SELECT PatientID, DATEDIFF(hour,DOB,GETDATE())/8766 
FROM   AEDepartment