I have very a basic question about the following behavior in MySQL.
Suppose we do the following GROUP BY
:
SELECT a, b, SUM(c)
FROM table
GROUP BY b;
What happens to the field a
, which is neither aggregated nor is it included in the GROUP BY
fields?
Does MySQL just implicitly apply FIRST(a)
to a
? If so, is this behavior consistent or does it grab a random value out of all values for a
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…