联接的位置 - 访问查询

时间:2015-12-04 15:32:42

标签: sql ms-access

我编写了SQL查询,显示Personnel表中的所有数据。我正在尝试仅为某个用户组获取记录Personnel.UserGroup='AA'我试图将其添加到Personnel.UserGroup='AA'它不显示该用户组的所有记录的条件中,不确定我错在哪里

SELECT Youth.cyberid, Youth.LastName, Youth.FirstName, Youth.Level,
   Youth.CareManager, Personnel.Supervisor, Youth.StartDate,
   Youth.CloseDate
FROM (Youth
LEFT JOIN [Y Summary]
   ON Youth.[cyberid]   = [Y Summary].[cyberid])
INNER JOIN Personnel 
   ON Youth.CareManager = Personnel.PersonnelName, Personnel.PersonnelName
WHERE (((Youth.CloseDate) Is Null)
  And (([Y Summary].cyberid) Is Null)
  And ((Youth.CyberAdminOnly)<>True)) Or ((([Y Summary].cyberid) Is Null)
  And ((Youth.CyberAdminOnly)<>True)
  And ((Month(Youth.CloseDate))=Month(Date()))
  And ((Year(Youth.CloseDate))=Year(Date())));

0 个答案:

没有答案