这是我的查询:
SELECT COUNT(*) AS Expr1, name, appointment_date
FROM ReportingTable
GROUP BY name, appointment_date
我想按月对约会日期列进行分组,如下所示:
SELECT COUNT(*) AS Expr1, name, appointment_date
FROM ReportingTable
GROUP BY name, MONTH(appointment_date)
但我的查询引发以下错误:
列“appointment_date”在所选列表中无效,因为它既不包含在聚合函数也不包含在 groupby 子句中。