I'm have trouble with having to work with ONLY_FULL_GROUP_BY mode (I wouldn't want to, but I'm forced to). The problem is that this requires me to include a column in the group by clause. This is a column I need to select (it's a timestamp column), but need to group by "day, month, and year". like so:
SELECT COUNT(id) AS howmuch, date_event
FROM mytable AS st
WHERE date_event BETWEEN SUBDATE(CURDATE(), 7) AND NOW()
GROUP BY DAY(date_event), MONTH(date_event), YEAR(date_event)
ORDER BY date_event
but this throws error:
'mydb.st.date_event' isn't in GROUP BY
because date_event is not in GROUP BY, because it can't be. If I add date_event to group by, the query works, but logically it does not return what I want (I need to know how many entries are in that DB table, grouped by day.
Any hints how to achieve this?
Thanks!!