我需要一些关于Select的建议:我需要按员工和月份计算金额。通过Group by我可以选择月份 - 金额将被汇总 - 但不是按员工计算,而是按月计算:
SELECT MONTHNAME(datum) AS Monat,ID AS id, STATUS AS STATUS, MA AS Mitarbeiter,SUM(preis) AS Preis
FROM wccrm_prov
GROUP BY MONTHNAME(datum)
答案 0 :(得分:0)
答案可能类似于
SELECT
MONTHNAME(datum) AS Monat
, EMPLOYEE
,ID AS id
,STATUS AS STATUS
,MA AS Mitarbeiter
,SUM(preis) AS Preis
FROM wccrm_prov
GROUP BY MONTHNAME(datum), EMPLOYEE
我使用了新字段EMPLOYEE,因为我不熟悉问题查询文本中使用的非英语语言。显然,您可以将其与您的员工字段交换