私はこのSQL文を持っています:
SELECT inquiry_response,
inquiry_response_date,
date_initiated,
date_closed,
(select count(*)
from Inquiry_Responses
where InquiryID = 1 AND lawyerID = 1) as col1
(select count(*)
from Lawyers, Firms, Conflicts, Inquiries, Inquiry_Responses
where Conflicts.lawyerID=Lawyers.lawyerID and
Inquiry_Responses.lawyerID=Lawyers.lawyerID and
Inquiry_Responses.InquiryID=Inquiries.InquiryID and
Conflicts.firmID=Firms.firmID and
Conflicts.firmID IN
(select FirmID
from WorkPeriod
where InquiryID = 1) and
Inquiry_Responses.lawyerID= 1 and
Inquiries.InquiryID = 1 and
date_created between date_initiated and inquiry_response_date) as col2
from Inquiry_Responses, Inquiries
WHERE Inquiries.InquiryID = Inquiry_Responses.InquiryID AND Inquiry_Responses.InquiryID = 1 AND lawyerID = 1
構文エラーが発生します:
Msg 156, Level 15, State 1, Line 20
Incorrect syntax near the keyword 'as'.
なぜこれが起こっているのか誰にも分かりますか?
注: 1 の値は実際にはパラメーター変数ですが、後で入力します。
ありがとう。