0

以下代码给出了计数不同值的语法错误。

SELECT SUM(house_thanas.target)               AS target, 
       SUM(reports_db.ach_total)              AS Total, 
       Count(DISTINCT reports_db.report_date) AS WorkingDays 
FROM   ((areas 
         INNER JOIN distribution_houses 
                 ON areas.area_id = distribution_houses.area_id) 
        INNER JOIN house_thanas 
                ON distribution_houses.distribution_house_id = 
                   house_thanas.distribution_house_id) 
       INNER JOIN reports_db 
               ON house_thanas.thana_id = reports_db.thanaid 
WHERE  reports_db.report_date BETWEEN 
       #2012/02/10 12:00:00 am# AND #2013/02/09 11:59:59 pm# 

如何在 microsoft access 数据库中找到不同的计数值?

4

1 回答 1

0

我认为您没有看到建议的内容,即:

 SELECT SUM(house_thanas.target)               AS target, 
   SUM(reports_db.ach_total)              AS Total, 
   (SELECT Count(*) As JustOnce
    FROM (SELECT DISTINCT report_date FROM reports_db)) AS WorkingDays 

 <...>

在查询设计窗口,设计视图中,子查询应设置为表达式。

于 2013-02-09T12:20:59.973 回答