Why I can't use multiple columns in a GROUP BY query in MySQL? -


i need make sql groups 3 different columns, query:

select      notification.type,      notification.triggerer,      notification.to_what,     any_value(user_data.name) name,     any_value(user_data.surname) surname,     any_value(user_data.avatarimage) avatarimage,     count(*) counter notification  inner join user_data     on notification.triggerer = user_data.owner notification.owner = "c6cecc891f6c4cc84cc0b62062578e52"     , isdelete=0 order notification.id desc group notification.triggerer, notification.type, notification.to_what limit 0,100 

but when make this, shows me error:

> #1064 - have error in sql syntax; check manual corresponds  mysql server version right syntax use near  'group notification.triggerer, notification.type, notification.to_what limit ' @ line 15 

how can fix it?

you can use it, your group by must before order by

select      notification.type,      notification.triggerer,      notification.to_what,     any_value(user_data.name) name,     any_value(user_data.surname) surname,     any_value(user_data.avatarimage) avatarimage,     count(*) counter notification  inner join user_data     on notification.triggerer = user_data.owner notification.owner = "c6cecc891f6c4cc84cc0b62062578e52"     , isdelete=0 group notification.triggerer, notification.type, notification.to_what order notification.id desc limit 0,100 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -