我使用以下代码在 DAO 中查询我的数据库,效果很好:
SELECT *
FROM (Resources LEFT JOIN [Select * FROM AvailabilityBlocks LEFT JOIN Location ON AvailabilityBlocks.LocationID=Location.LocationID WHERE ((CStr(AvailabilityBlocks.LocationID) IN ('8', '14', '16', '1', '15', '17', '10', '9', '19', '12', '5', '18', '13', '20', '3', '26', '2', '25', '28', '27') AND (AvailabilityBlocks.Type = 3 OR AvailabilityBlocks.Type = 4)) OR AvailabilityBlocks.Type = 2) AND Begin < #15-Jul-2013 12:00:00 AM# And Begin >= #08-Jul-2013 12:00:00 AM#]. AS FilteredTable ON Resources.ResourceID=FilteredTable.ResourceID) LEFT JOIN EmployeeTypes ON EmployeeTypes.TypeID=Resources.EmployeeType ORDER BY RClass, Resources.LastName ASC, Resources.FirstName ASC, Resources.ResourceID ASC, AvailabilityBlocks.Begin ASC, AvailabilityBlocks.End Desc, Location.SubType DESC
然后我将所有代码转换为 ADO,SQL 停止工作,现在显示
FROM 子句中的语法错误。
错误信息!
任何帮助,将不胜感激!