A digression: I am used to PostgreSQL and suddenly started using MySQL one day. I found that a non-key and non-aggregation-free SQL statement like the original poster can actually be established, and I was filled with fear. Later I discovered that MySQL didn’t even use the same window functions that are commonplace in PostgreSQL, and I was completely speechless. Okay, let’s provide something useful and implement the rank window function in MySQL: http://stackoverflow.com/questions/3333665/rank-function-in-mysql
Modify sql_mode in the MySQL configuration file and remove ONLY_FULL_GROUP_BY. If there is no sql_mode, add a line
SELECT id, value FROM (SELECT id, value FROM test ORDER BY id ) AS b GROUP BY id
A digression:
I am used to PostgreSQL and suddenly started using MySQL one day. I found that a non-key and non-aggregation-free SQL statement like the original poster can actually be established, and I was filled with fear.
Later I discovered that MySQL didn’t even use the same window functions that are commonplace in PostgreSQL, and I was completely speechless.
Okay, let’s provide something useful and implement the rank window function in MySQL:
http://stackoverflow.com/questions/3333665/rank-function-in-mysql