Open dvdcut opened 4 years ago
i had lots of issues in start with this sql but for me workaround was to turn off the ONLY_FULL_GROUP_BY MySQL Mode, this was the very reason behind raspberry pi img file as i had to many emails from users with all sorts of issues and linux is ever changing environment and what instructions are correct today may not be valid tomorrow and its very hard to keep up with all that.
i know any_value function isnt available in MariaDB (which PiHome raspberry pi img is based on) that any_value is not really a workaround so you can use it in both version and on top of this it isnt recommended either here is link to why but i m using it on PiConnect site until i find better solution. #11 was rejected as we were and we are using group by in schedules and may be many other places.
this issue is driving from old rejected pull request: #11
MySQL versions >5.7.5 now have a default 'ONLY_FULL_GROUP_BY' SQL mode, so default MySQL installation will throw a wobbly: "Reject queries for which the select list, HAVING condition, or ORDER BY list refer to nonaggregated columns that are neither named in the GROUP BY clause nor are functionally dependent on (uniquely determined by) GROUP BY columns." AFAICS, 'time_id' is unique and there is only one 'temperature' set for each row, so I can't see the reason for the "MAX(temperature) as max_c" (which necessitates the 'GROUP BY') ... am I missing something? I also removed the 'seconds' from the schedules displayed as they take up valuable screen space & tell us nothing.
when i try to execute following query and google first link is to this pull request #11.
https://user-images.githubusercontent.com/53821067/88051077-f4e93300-cb4f-11ea-9c7e-5d244b6683ae.png
@pihome-shc gave fix for this one query
mariadb do not have the 'ANY VALUE' function. link
after have gone through all homelist, schedules, there aren't many query that need changing