Welcome Guest, Not a member yet? Register   Sign In
database error when using DISTINCT and ORDER BY
#4

ok i need to repeat my error in details

i want to get only one user_id from my inbox db by using group by or distinct  but both not working

here is my sql code for group by

Code:
SELECT message_user_name FROM cms_inbox GROUP BY message_user_id ORDER BY message_time DESC

and error i get from it in only latest version on mysql 5.7 is

Code:
Error Number: 1055

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.cms_inbox.message_user_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

demo on w3schools website HERE

it works on that website but dont know why my code is showing error
Reply


Messages In This Thread
RE: database error when using DISTINCT and ORDER BY - by corey - 05-05-2017, 10:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB