Rouven: Mittelwert gleicher Datensätze in MySQL-DB

Beitrag lesen

Hello,

das sollte kein Problem sein. Verwende GROUP BY mit der Funktion AVG. Bitte komme dabei NICHT auf die Idee die MySQL-Macke auszunutzen dir nicht-gruppierte, nicht-aggregierte Werte zu selektieren - Bsp.:
Gut:
SELECT a, b, SUM(c), AVG(d)
FROM x
GROUP BY a, b

Schlecht
SELECT a, b, SUM(c)
FROM x
GROUP BY a
--> Wert für b ist pseudo-definiert.

MfG
Rouven

--
-------------------
sh:| fo:} ch:? rl:( br:& n4:{ ie:| mo:} va:) js:| de:] zu:| fl:( ss:) ls:& (SelfCode)
Ambition is the last refuge of failure.  --  Oscar Wilde (Irish Poet, Novelist, Dramatist and Critic, 1854-1900)