这是我的问题,我有这个请求(它有效),但我想用TO_DAYS(notification.created_at)
用户的最新操作替换。
我尝试使用TO_DAYS(MAX(notification.created_at))
但它返回"#1111 - Invalid use of group function"
.
SELECT user.email, notification.type, max(notification.created_at) AS date
FROM user, notification
WHERE (user.id = notification.user_id) AND (TO_DAYS(NOW()) - TO_DAYS(notification.created_at) >= 30)
GROUP BY user.id
ORDER BY `date` DESC