多个内部联接不起作用 - 在sql中访问ms

时间:2014-09-29 18:59:16

标签: sql ms-access

我在使用多个内连接工作时遇到我的FROM语句时遇到了问题。

以下是代码:

SELECT tblPatientHistoryBaseline.LastName,
tblPatientHistoryBaseline.FirstName,
tblQuestionnaires.CR,
tblFollowUpQs.AdditionalHealthProblems,
Switch( tblFollowUpQs.AdditionalHealthProblems LIKE '*[?]*', 0, tblFollowUpQs.AdditionalHealthProblems NOT LIKE '*[?]*', 1),
tblFollowUpQs.Visit,
IIf(tblFollowUpQs.AdditionalHealthProblems Like "*IBS-A*" OR tblFollowUpQs.AdditionalHealthProblems Like "*IBS - A*",1,0),
IIf(tblFollowUpQs.AdditionalHealthProblems Like "*IBS-C*" OR tblFollowUpQs.AdditionalHealthProblems Like "*IBS - C*",1,0),
IIf(tblFollowUpQs.AdditionalHealthProblems Like "*IBS-D*" OR tblFollowUpQs.AdditionalHealthProblems Like "*IBS - D*",1,0),
IIf(tblFollowUpQs.AdditionalHealthProblems Like "*IBS-Unknown*" OR tblFollowUpQs.AdditionalHealthProblems Like "*IBS - Unknown*",1,0),

tblQuestionnaires.WetClothesChildDEQ, 
tblQuestionnaires.WetSelfAtNightChildDEQ, 
tblQuestionnaires.NoDailyBMChildDEQ, 
tblQuestionnaires.PushBMChildDEQ, 
tblQuestionnaires.UrinateOnceTwiceDailyChildDEQ, 
tblQuestionnaires.HoldByCrossingSquattingChildDEQ, 
tblQuestionnaires.VoidCouldNotWaitChildDEQ, 
tblQuestionnaires.HadToPushVoidChildDEQ, 
tblQuestionnaires.VoidingHurtChildDEQ, 
tblQuestionnaires.WetClothesMonthDEQ, 
tblQuestionnaires.WetSelfAtNightMonthDEQ, 
tblQuestionnaires.NoDailyBMMonthDEQ, 
tblQuestionnaires.PushBMMonthDEQ, 
tblQuestionnaires.UrinateOnceTwiceDailyMonthDEQ, 
tblQuestionnaires.HoldByCrossingSquattingMonthDEQ, 
tblQuestionnaires.VoidCouldNotWaitMonthDEQ, 
tblQuestionnaires.VoidingHurtMonthDEQ, 
tblQuestionnaires.HadToPushVoidMonthDEQ,
tblQuestionnaires.DEQCompleted

FROM (tblQuestionnaires 
  INNER JOIN tblPatientHistoryBaseline ON (tblPatientHistoryBaseline.CR = tblQuestionnaires.CR) AND (tblPatientHistoryBaseline.Visit = tblQuestionnaires.Visit)) 
  INNER JOIN tblFollowUpQs ON (tblQuestionnaires.CR = tblFollowUpQs.CR) AND (tblQuestionnaires.Visit = tblFollowUpQs.Visit)

WHERE (((tblFollowUpQs.AdditionalHealthProblems) Like '*IBS*') AND (tblQuestionnaires,DEQCompleted > 0);

我相信我的FROM声明存在问题。 我已经检查了代码的所有其他部分,它们似乎独立工作,但不是在我将它们组合在一起时。 我的查询根本没有填充。

谢谢!

0 个答案:

没有答案