I am trying to get the SUM of a column in my MySQL query
SELECT pi.*
, pr.EK2
, pr.EK3
, SUM(P_OrderTotal) as SUM_P_OrderTotal
FROM pixi pi
LEFT
JOIN konditionen pr
ON pi.P_EAN = pr.EAN
WHERE pi.P_OrderDate >= '2021-03-01'
AND pi.P_OrderDate <= '2021-03-31';
This gives me:
In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'table.pi.P_OrderNr'; this is incompatible with sql_mode=only_full_group_by
The query runs fine without the SUM(P_OrderTotal) as SUM_P_OrderTotal
part. How would I solve this?