1
這是我的查詢:SQL GROUPBY月
SELECT COUNT(*) AS Expr1, name, appointment_date
FROM ReportingTable
GROUP BY name, appointment_date
我想組appointment_date列按月如下:
SELECT COUNT(*) AS Expr1, name, appointment_date
FROM ReportingTable
GROUP BY name, MONTH(appointment_date)
但我的查詢會引發以下錯誤:
Column "appointment_date" is invalid in the selected list because it is not contained in either aggregate function or groupby clause .
很棒@davidhyogo。謝謝 ... – 2012-07-29 08:14:20