我需要创建一个按三个不同列分组的sql,这是我的查询:
SELECT
notification.type,
notification.triggerer,
notification.to_what,
ANY_VALUE(user_data.name) AS name,
ANY_VALUE(user_data.surname) AS surname,
ANY_VALUE(user_data.avatarimage) AS avatarimage,
COUNT(*) AS counter
FROM notification
INNER JOIN user_data
ON notification.triggerer = user_data.owner
WHERE notification.owner = "c6cecc891f6c4cc84cc0b62062578e52"
AND isdelete=0
ORDER BY notification.id DESC
GROUP BY notification.triggerer, notification.type, notification.to_what
LIMIT 0,100
但是当我这样做时,它会显示一个错误:
> #1064 - You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near
'GROUP BY notification.triggerer, notification.type, notification.to_what
LIMIT ' at line 15
我该如何解决?
答案 0 :(得分:1)
您可以使用它,但您的<form>
必须在$something = $this->input->post('something');
group by