Sql 无法列出在特定月份和年份处理最多约会的员工

Sql 无法列出在特定月份和年份处理最多约会的员工,sql,Sql,我试图列出在特定的月份和年份中处理最多/最少约会的员工,但由于某些原因,他们无法工作。请任何人帮我解决这个问题 我尝试了下面的方法,但不起作用: SELECT COUNT (a.staff_id) AS appointments_count, appointment_date, b.staff_name FROM appointment a, staff b WHERE a.staff_id = b.staff_id GROUP BY staff_name ORD

我试图列出在特定的月份和年份中处理最多/最少约会的员工,但由于某些原因,他们无法工作。请任何人帮我解决这个问题

我尝试了下面的方法,但不起作用:

SELECT COUNT (a.staff_id) AS appointments_count,
       appointment_date,
       b.staff_name
FROM appointment a, staff b
WHERE a.staff_id = b.staff_id
GROUP BY staff_name
ORDER BY appointments_count DESC

你可以试试下面的方法-

SELECT b.staff_name,COUNT(a.staff_id) AS appointments_count
FROM appointment a join staff b on a.staff_id = b.staff_id
where appointment_date>='20200801' and appointment_date<='20200830'
GROUP BY b.staff_name 
ORDER BY appointments_count DESC
选择b.staff\u name,COUNT(a.staff\u id)作为约会计数
从约会a加入a.staff\u id=b.staff\u id上的员工b

其中约会日期>='20200801'和约会日期以表格形式提供您所需的输出您尝试了什么但没有成功?@Fahmi我已经编辑了我的问题…您可以检查它now@GMB我在我的报告中提到了上述内容question@Sansui,此查询返回的错误或结果集是什么?错误代码:1305 FUNCTION propertyrental.COUNT不存在exist@Sansui,您正在使用哪个数据库管理系统?虽然我已经编辑了代码,但您可以尝试一下