sql - MySQL seems to have a bug with distinct, avg, and group-by -



sql - MySQL seems to have a bug with distinct, avg, and group-by -

the next query seems behave incorrectly. grouping on single field , average on field distinct avg should homecoming 1 row every distinct average. if avg replaced count illustration query homecoming 2 rows , if distinct removed or replaced query returns 3 rows.

create table x (x real); insert x values (1), (2), (3), (3); select distinct avg(x) x grouping x;

mysql returns:

+--------+ | avg(x) | +--------+ | 1 | +--------+

postgres returns:

avg ----- 1 2 3

below query homecoming output :

avg ----- 1 2 3

query

select avg(x) x grouping x;

here sql fiddle

demo

mysql sql rdbms

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -