Skip to main content
Please read this before rolling back this edit - we are removing SO documentation links according to guidelines here: https://meta.stackoverflow.com/questions/356294/removing-documentation-reputation-archive-and-links?cb=1
Source Link
Graham
  • 7.9k
  • 20
  • 67
  • 92

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declaresANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declaresANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.

Source Link
O. Jones
  • 109.5k
  • 17
  • 134
  • 187

The best solution to this problem is, of course, using a complete GROUP BY expression.

But there's another solution that works around the ONLY_FULL_GROUP_BY blocking of the old MySQL extension to GROUP BY.

SELECT name, ANY_VALUE(type) type, ANY_VALUE(language) language, ANY_VALUE(code) code FROM users WHERE verified = '1' GROUP BY name ORDER BY count DESC LIMIT 0, 25 

ANY_VALUE() explicitly declares what used to be implicit in MySQL's incomplete GROUP BY operations -- that the server can choose, well, any, value to return.